Support

Account

Home Forums General Issues Group checking not working

Unread

Group checking not working

  • I have a group field (ce_hours) that has 3 subfields(each a text field)

    None of the three subfields have data but this code always shows true. How do i test for a case where all three fields are empty?

    I have tried the code both these ways:

                    /*** if ( have_rows ('ce_hours') ){
                        while ( have_rows ('ce_hours') ) : the_row();
                                echo '<ul>';
                                if (get_sub_field('rn_hours')) echo '<li>'.get_sub_field('rn_hours').' credit hours for RNs</li>';
                                if (get_sub_field('nab_hours')) echo '<li>'.get_sub_field('nab_hours').' credit hours for NABs</li>';
                                if (get_sub_field('lvnlpn_hours')) echo '<li>'.get_sub_field('lvnlpn_hours').' credit hours for LVN/LPNs</li>';
                                echo '</ul>';
                        endwhile;
                    } else { echo '<p>There are no credit hours offered for this webinar.</p>';}  **/
    
                    if ( get_field('ce_hours') ){
                                echo '<ul>';
                                if (get_sub_field('rn_hours')) echo '<li>'.get_sub_field('rn_hours').' credit hours for RNs</li>';
                                if (get_sub_field('nab_hours')) echo '<li>'.get_sub_field('nab_hours').' credit hours for NABs</li>';
                                if (get_sub_field('lvnlpn_hours')) echo '<li>'.get_sub_field('lvnlpn_hours').' credit hours for LVN/LPNs</li>';
                                echo '</ul>';
    
                    } else {
    			echo '<p>There are no credit hours offered for this webinar.</p>';
                    }
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.