function clientside_validation_states_regular in Clientside Validation 7
1 call to clientside_validation_states_regular()
- clientside_validation_states_after_build_recurse in clientside_validation_states/
clientside_validation_states.module
File
- clientside_validation_states/
clientside_validation_states.module, line 26 - Clientside Validation support for Form API's #states.
Code
function clientside_validation_states_regular($form_id, $element, &$js_rules, $form_state) {
static $js_added = FALSE;
foreach ($element['#states'] as $state => $triggers) {
while (strpos($state, '!') === 0) {
$state = drupal_substr($state, 1);
}
if ($state == 'required' || $state == 'optional') {
if (!$js_added) {
drupal_add_js(drupal_get_path('module', 'clientside_validation_states') . '/clientside_validation_states.js');
$js_added = TRUE;
}
$js_rules[$element['#name']]['statesrequired'] = TRUE;
}
}
}