The form has two radio buttons like follows.The "design" radio field should be visible only when user selects 'Ten' or 'hundred' from the "price" field.
If user choose 'other' it should not be visible.
I tried like follows, it's working but by default the 'design' field is come with visible state.
//$options array is dynamic.
$options = array(10 => 'Ten', 100 => 'hundred', 'other' => 'Other');
$form['price'] = array(
'#type' => 'radios',
'#title' => t('Price?'),
'#options' => $options,
);
$form['design'] = array(
'#type' => 'radios',
'#title' => t('Designs'),
'#options' => $designs,
);
$form['design']['#states'] = array(
'visible' => array(
array(':input[name="price"]' => array('!value' => 'other')),
),
);
I've tried several ways like follows with no luck.
array(':input[name="price"]' => array('!value' => '')),
array(':input[name="price"]' => array('checked' => TRUE)),
Is there any option like to check the selected value is numeric or not? like
array(':input[name="price"]' => array('value' => isNumeric)),
or the other option would loop through the dynamic option values?
array(':input[name="category"]' => array('value' => 10)),
'or',
array(':input[name="category"]' => array('value' => 100)),
'or',
.
.
etc
Any suggestions or input would be much appreciated.