I wanted to add #states property to a select list field in cck input form created by content type. I ve tried the following code but the states property is not set to the field. Can anyone suggest on how to do it.
$form['field_ctype']['und']['#ajax']=array('callback' =>'_ajax_menu_check_boxes',
'wrapper' =>'edit-field-sub-menu',
'effect' => 'fade',
'event' => 'change',
);
$form['field_sub_menu']['und']['#states']=array(
'visible' => array(
':input[name="field_ctype"]' => array('value' => '2')));
could anyone suggest me where I am going wrong. Is it possible to add ajax property ans states property to a same field?
Note : The Ajax property for the field_ctype works fine. Only the states property is not working.
':input[name="field_ctype"]' => array('value' => '2')));
). It only worked for me, when I was casting the integer to string:':input[name="field_ctype"]' => array('value' => (string)'2')));
Maybe it will help someone.