You are here

function clientside_validation_form_after_build in Clientside Validation 6

Same name and namespace in other branches
  1. 8.2 clientside_validation.module \clientside_validation_form_after_build()
  2. 8 clientside_validation.module \clientside_validation_form_after_build()
  3. 7.2 clientside_validation.module \clientside_validation_form_after_build()
  4. 7 clientside_validation.module \clientside_validation_form_after_build()
  5. 3.0.x clientside_validation.module \clientside_validation_form_after_build()
  6. 2.0.x clientside_validation.module \clientside_validation_form_after_build()

Regular form + CCK

1 string reference to 'clientside_validation_form_after_build'
clientside_validation_form_alter in ./clientside_validation.module
Implementation of hook_form_alter().

File

./clientside_validation.module, line 225
Add client side validation to a webform.

Code

function clientside_validation_form_after_build(&$form, &$form_state) {
  static $js_rules = array();
  $data =& $form;
  $data['__drupal_alter_by_ref'] = array(
    &$form_state,
    &$js_rules,
  );
  drupal_alter("clientside_validation_form", $data);
  if (!empty($js_rules)) {
    $settings = array();
    _clientside_validation_add_general_settings($settings, $form['#id']);
    _clientside_validation_add_special_rules($js_rules, $settings, $form);
    if (variable_get('clientside_validation_use_minified', 0) == 0) {
      drupal_add_js(drupal_get_path('module', 'clientside_validation') . '/jquery-validate/jquery.validate.js', 'module');
    }
    else {
      drupal_add_js(drupal_get_path('module', 'clientside_validation') . '/jquery-validate/jquery.validate.min.js', 'module');
    }

    //add our js file to the footer to support vertical_tabs
    drupal_add_js(drupal_get_path('module', 'clientside_validation') . '/clientside_validation.js', 'module', 'footer');
    drupal_add_js($settings, 'setting');
  }
  return $form;
}