Commit 775b4813 authored by drupalrv's avatar drupalrv Committed by Peter Droogmans
Browse files

Issue #1730952 by drupalrv, Davidovich: Fixed Validate ajax submits clientside...

Issue #1730952 by drupalrv, Davidovich: Fixed Validate ajax submits clientside before doing ajax request.
parent c7e90dbf
......@@ -46,8 +46,9 @@
// Set validation for ajax forms
for (var ajax_el in Drupal.settings.ajax) {
if (typeof Drupal.ajax[ajax_el] !== 'undefined' && Drupal.ajax[ajax_el].validate_first) {
var origBeforeSubmit = Drupal.ajax[ajax_el].options.beforeSubmit;
Drupal.ajax[ajax_el].options.beforeSubmit = function (form_values, element, options) {
var ajax_elem = ajax_el;
var origBeforeSubmit = Drupal.ajax[ajax_elem].options.beforeSubmit;
Drupal.ajax[ajax_elem].options.beforeSubmit = function (form_values, element, options) {
var ret = origBeforeSubmit(form_values, element, options);
// If this function didn't return anything, just set the return value to true.
// If it did return something, allow it to prevent submit if necessary.
......@@ -56,7 +57,7 @@
}
ret = ret && Drupal.myClientsideValidation.validators[element.attr('id')].form();
if (!ret) {
Drupal.ajax[ajax_el].ajaxing = false;
Drupal.ajax[ajax_elem].ajaxing = false;
}
return ret;
};
......
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