clientside_validation_webform.module in Clientside Validation 7.2
Same filename and directory in other branches
Adds clientside validation support for the webform module
File
clientside_validation_webform/clientside_validation_webform.moduleView source
<?php
/**
* @file
* Adds clientside validation support for the webform module
*/
/**
* Implements hook_ctools_plugin_directory().
*/
function clientside_validation_webform_ctools_plugin_directory($module, $plugin) {
if ($module == 'clientside_validation') {
return 'plugins/' . $plugin;
}
}
function clientside_validation_webform_form_webform_component_edit_form_alter(&$form, &$form_state, $form_id) {
$component = $form_state['build_info']['args'][1];
$form['validation']['exclude_cv'] = array(
'#type' => 'checkbox',
'#title' => 'Exclude from clientside validation',
'#description' => 'Check this option if you do not want to add clientside validation.',
'#default_value' => isset($component['extra']['exclude_cv']) ? $component['extra']['exclude_cv'] : FALSE,
);
array_unshift($form['#submit'], 'clientside_validation_webform_webform_component_edit_form_submit');
}
function clientside_validation_webform_webform_component_edit_form_submit($form, &$form_state) {
// Move setting to extra so it gets saved.
$form_state['values']['extra']['exclude_cv'] = $form_state['values']['validation']['exclude_cv'];
}