Support

Account

Home Forums General Issues Select – if(//nothing is selected\\)

Unread

Select – if(//nothing is selected\\)

  • I’m trying to use a conditional statement with a “select” element to get hide the field on the page if nothing is selected.

    I’ve tried with the “single value statement” on the “select” documentation page, but it wouldn’t work using “null”, “- Select -“.

    I’ve tried using the “multiple value statement” in the documentation but I’m getting “implode() invalid arguments passed”. The weird thing is, I’m not getting this the first time I edit the page and select the displayed “-Select-” in the back-end of the website. I’m only getting it when I edit the page again, say, to change another field, and it doesn’t have “-Select-” highlighted when I click “update”.

    Here is my current statement (It’s a bit messy as I’m still testing with it):

    if( is_array(get_field('product_play_type')) && in_array( 'null', get_field('product_play_type', TRUE) ) )
        {
            echo '';
    	return false;
        } else {
            ?><h4><span>Play Type:</span> <br>&nbsp;&nbsp;&nbsp;<?php $page = $post;?>
    	<?php echo implode(', ', get_field('product_play_type', $page, true)); ?></h4><?php
        }?>

    Any help would be much appreciated.

Viewing 1 post (of 1 total)

The topic ‘Select – if(//nothing is selected\\)’ is closed to new replies.