Conditional Logic in options for select box

Support MB Conditional Logic Conditional Logic in options for select box

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #4310
    MD3MD3
    Participant

    is it possible to have a different options for each select box?

    i have this code for selectbox(Lets say the values of this selectbox is type1 and type2)

    array(
    	'name' => 'Type',
    	'id'   => 'pr_type',
    	'placeholder' => 'Select Type',
    	'type'        => 'taxonomy',
    	'taxonomy'    => 'bedroom_product_type',
    	'field_type'  => 'select',
    	'query_args'  => array(),
    )

    Then this selectbox will show if the user select "type1"

    array(
            'hidden'      => array('pr_type', '!=', 'type1'),
    	'name'        => 'Size',
    	'id'          => 'pr_size',
    	'placeholder' => 'Select Size',
    	'type'        => 'select',
    	'options'     => array(
    		'option_a1' => 'Option A1',
    		'option_a2' => 'Option A2',
                    'option_a3' => 'Option A3',
    	),
    ),

    Then if the user selects "type2" this is the selectbox

    array(
            'hidden'      => array('pr_type', '!=', 'type2'),
    	'name'        => 'Size',
    	'id'          => 'pr_size',
    	'placeholder' => 'Select Size',
    	'type'        => 'select',
    	'options'     => array(
    		'option_b1' => 'Option B1',
    		'option_b2' => 'Option B2',
    	),
    ),

    This codes doesn't work when updating only for saving for the first time

    i want to use only one id for this

    #4320
    Tan NguyenTan Nguyen
    Participant

    Dear MD3,

    Sorry the ID attribute should works as it does, it's impossible to set same id for different fields. And Conditional Logic only works with different ids.

    Best regards,

    Tan

Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘Conditional Logic in options for select box’ is closed to new replies.