Displaying checklist and radio content
-
Hi,
I was wondering how to display both checkbox and radio content. I’d like it to function so that: if the user checks boxes or chooses a certain radio button, it shows the appropriate content.
For example, I want to have a field:
Field::make("checkbox", "rep_verified", "Is the info verified?") ->set_option_value('Verified!'),
If the field is check marked, I’d like the HTML to show:
<div class="verified">Verified!</div>
As for the radio button, I’d like to have content be displayed/hidden based on the option. If this was the field:
Field::make("radio", "rep_none", "Is there a rep?") ->add_options(array( 'yes' => 'Yes', 'no' => 'No', ))
If
no
, then display:
<li class="tab col s12 disabled red lighten-4"><a href="#none">None</a></li>
Ifyes
, then display:<?php if ( $tabs = carbon_get_the_post_meta( 'house_reps', 'complex' ) ): ?> <ul class="tabs card grey lighten-5"> <?php foreach ( $tabs as $tab ): ?> <li class="tab col <?php echo carbon_get_post_meta(get_the_ID(), 'house_reps_tabs'); ?>"><a href="#<?php echo sanitize_title_with_dashes( $tab['rep_last_name'] ); ?>"> <?php echo $tab['rep_last_name'] . ' (' . carbon_get_post_meta(get_the_ID(), 'state_abb') . '-' . $tab['rep_cong_dist_num'] . ')' ?></a> </li> <?php endforeach ?> </ul> <?php endif ?>
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Displaying checklist and radio content’ is closed to new replies.