Commit ad66e048 authored by vlad.dancer's avatar vlad.dancer Committed by jelles
Browse files

Issue #2268513 by vlad.dancer | jongagne: Fixed Uncaught TypeError: Cannot...

Issue #2268513 by vlad.dancer | jongagne: Fixed Uncaught TypeError: Cannot read property 'serverSideErrors' of undefined .
parent 96e4b76a
......@@ -28,7 +28,23 @@
* @private
*/
jQuery.each(Drupal.myClientsideValidation.validators, function (formid) {
Drupal.myClientsideValidation.validators[formid].showErrors(Drupal.settings.clientsideValidation.forms[formid].serverSideErrors);
if (
!Drupal.settings.clientsideValidation.forms.hasOwnProperty(formid) ||
!Drupal.settings.clientsideValidation.forms[formid].hasOwnProperty('serverSideErrors')
) {
return;
}
var errors = Drupal.settings.clientsideValidation.forms[formid].serverSideErrors;
for(var error in errors) {
if(!errors[error]) { delete errors[error]; }
}
if ($.isEmptyObject(errors)) {
return;
}
Drupal.myClientsideValidation.validators[formid].showErrors(errors);
});
});
}
......
......@@ -37,7 +37,7 @@ function clientside_validation_ife_validator($form, $form_state) {
}
$js_settings['clientsideValidation']['forms'][$form_id]['serverSideErrors'] = $settings[$form['#form_id']];
drupal_add_js(drupal_get_path('module', 'clientside_validation_ife') . '/clientside_validation_ife.js');
clientside_validation_add_js_settings($settings);
clientside_validation_add_js_settings($js_settings);
}
function clientside_validation_ife_recurse_elements($element, $form_id, &$settings) {
......
Markdown is supported
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