Commit 52a767ca authored by Peter Droogmans's avatar Peter Droogmans
Browse files

Issue #1525360 by smilne23: Added Exclude specific fields based upon their DOM ID.

parent d40ab853
......@@ -21,7 +21,11 @@ function clientside_validation_webform_after_build_recurse($form_id, &$form, &$f
if ($children = array_values(element_children($form))) {
foreach ($children as $index => $item) {
$element = $form[$item];
if (isset($element['#title'])) {
$skipvalidation = FALSE;
if (isset($element['#webform_component']['extra']['exclude_cv']) && $element['#webform_component']['extra']['exclude_cv'] == "1") {
$skipvalidation = TRUE;
}
if (isset($element['#title']) && !$skipvalidation) {
if (isset($element['#type'])) {
if (isset($element['#webform_component']) && $element['#webform_component']['type'] == 'time' && isset($element['hour']['#name'])) {
$message = t('Hour in !name field is required.', array('!name' => variable_get('clientside_validation_prefix', '') . $element['#title'] . variable_get('clientside_validation_suffix', '')));
......@@ -357,3 +361,13 @@ function clientside_validation_webform_webform_validation_add_names(&$webform_va
}
}
}
function clientside_validation_webform_form_webform_component_edit_form_alter(&$form, &$form_state, $form_id) {
$component = $form_state['build_info']['args'][1];
$form['extra']['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,
);
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment