Commit abd0a5bf authored by Jelle Sebreghts's avatar Jelle Sebreghts
Browse files

Issue #1551616 by Jumoke: Added Does this work on Tab out?.

parent 330531f7
......@@ -69,6 +69,18 @@ function clientside_validation_admin_settings() {
'#default_value' => variable_get('clientside_validation_validate_onblur', 1),
);
$form['clientside_validation_validate_options']['clientside_validation_validate_onblur_always'] = array(
'#type' => 'radios',
'#options' => array(
'1' => t('Yes'),
'0' => t('No'),
),
'#title' => t('Always validate fields on blur'),
'#description' => t('Validate elements (except checkboxes/radio buttons) on blur, <strong>even nothing is entered before or if the fields hasn\'t been marked as invalid before.</strong>'),
'#default_value' => variable_get('clientside_validation_validate_onblur_always', 0),
'#states' => array('visible' => array(':input[name=\'clientside_validation_validate_onblur\']' => array('value' => 1))),
);
$form['clientside_validation_validate_options']['clientside_validation_validate_onkeyup'] = array(
'#type' => 'radios',
'#options' => array(
......
......@@ -332,6 +332,13 @@
if (!Boolean(parseInt(self.data.general.validateOnBlur))) {
validate_options.onfocusout = false;
}
if (Boolean(parseInt(self.data.general.validateOnBlurAlways))) {
validate_options.onfocusout = function(element) {
if ( !this.checkable(element) ) {
this.element(element);
}
}
}
if (!Boolean(parseInt(self.data.general.validateOnKeyUp))) {
validate_options.onkeyup = false;
}
......
......@@ -300,6 +300,7 @@ function _clientside_validation_add_general_settings(&$settings, $form_id) {
"scrollSpeed" => (int)variable_get('clientside_validation_scroll_speed', 1000),
"disableHtml5Validation" => variable_get('clientside_validation_disable_html5', 1),
"validateOnBlur" => variable_get('clientside_validation_validate_onblur', 1),
"validateOnBlurAlways" => (int)(variable_get('clientside_validation_validate_onblur_always', 0) && variable_get('clientside_validation_validate_onblur', 1)),
"validateOnKeyUp" => variable_get('clientside_validation_validate_onkeyup', 1),
"validateOnSubmit" => variable_get('clientside_validation_validate_onsubmit', 1),
);
......
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