I've two forms in a page, one of the field name is same in both forms.
<form id="form1"> <div class="div1"> <select id="field_a" name="field_a_name"> ... </select> </div> </form> <form id="form2"> <div class="div2"> <select id="field_a" name="field_a_name"> ... </select> </div> </form>
In hook form_alter, i assign the states to the field:
$field_state = array( 'visible' => array(':input[name="field_a_name"]' => array( array('value' => 'H') )) ); $form['field_a_name']['#states'] = $field_state;
The state does not work as expected, i believe it's caused by the same field name, most likely because of the jquery selector confused with the two fields with same name.
It works fine if the field name are different.
How to solve this?