May 26, 2013 - 21:34
July 7, 2013 - 17:13
I have a form field that is conditionally required depending on another field's value. Using Form API:
$form['details_' . $method['provider'] . '_' . $code]['lastname'] = array( '#type' => 'textfield', '#title' => t('Last Name'), '#disabled' => $disabled, '#states' => array( 'visible' => array(':input[name="method"]' => array('value' => $code)), 'required' => array(':input[name="method"]' => array('value' => $code)) ), );
The field shows up as required, but somehow fails to respect clientside validation?