Commit f9bc769f authored by alexey.gorb's avatar alexey.gorb Committed by jelles
Browse files

Issue #1896426 by alexey.gorb | MXT: Fixed "FIELD-NAME is a required field"...

Issue #1896426 by alexey.gorb | MXT: Fixed "FIELD-NAME is a required field" became "This field is required" upgrading to latest DEV.
parent 144371aa
...@@ -723,10 +723,9 @@ ...@@ -723,10 +723,9 @@
$checkboxes.addClass(identifier); $checkboxes.addClass(identifier);
$checkboxes.each(function(){ $checkboxes.each(function(){
var $checkbox = $(this); var $checkbox = $(this);
var rule = self.forms[formid].checkboxrules[r];
var newrule = { var newrule = {
require_from_group: [min, '.' + identifier] require_from_group: [min, '.' + identifier]
} };
$checkbox.rules("add", newrule); $checkbox.rules("add", newrule);
$checkbox.change(hideErrordiv); $checkbox.change(hideErrordiv);
...@@ -744,7 +743,6 @@ ...@@ -744,7 +743,6 @@
$.extend(self.validators[formid].settings.messages['.' + identifier], { $.extend(self.validators[formid].settings.messages['.' + identifier], {
require_from_group: message require_from_group: message
}); });
console.log(self.validators[formid].settings.messages);
} }
}); });
self.time.stop('checkboxrules'); self.time.stop('checkboxrules');
...@@ -753,7 +751,8 @@ ...@@ -753,7 +751,8 @@
self.time.start('daterangerules'); self.time.start('daterangerules');
jQuery.each (self.forms[formid].daterangerules, function(r) { jQuery.each (self.forms[formid].daterangerules, function(r) {
$form.find('#' + r).find('input, select').not('input[type=image]').each(function(){ $form.find('#' + r).find('input, select').not('input[type=image]').each(function(){
var rule = self.forms[formid].daterangerules[r]; // Make sure we are working with the copy of rules object.
var rule = jQuery.extend(true, {}, self.forms[formid].daterangerules[r]);
if (typeof self.validators[formid].settings.messages[r] === 'undefined') { if (typeof self.validators[formid].settings.messages[r] === 'undefined') {
self.validators[formid].settings.messages[r] = {}; self.validators[formid].settings.messages[r] = {};
} }
...@@ -770,7 +769,8 @@ ...@@ -770,7 +769,8 @@
self.time.start('dateminrules'); self.time.start('dateminrules');
jQuery.each (self.forms[formid].dateminrules, function(r) { jQuery.each (self.forms[formid].dateminrules, function(r) {
$form.find('#' + r).find('input, select').not('input[type=image]').each(function(){ $form.find('#' + r).find('input, select').not('input[type=image]').each(function(){
var rule = self.forms[formid].dateminrules[r]; // Make sure we are working with the copy of rules object.
var rule = jQuery.extend(true, {}, self.forms[formid].dateminrules[r]);
if (typeof self.validators[formid].settings.messages[r] === 'undefined') { if (typeof self.validators[formid].settings.messages[r] === 'undefined') {
self.validators[formid].settings.messages[r] = {}; self.validators[formid].settings.messages[r] = {};
} }
...@@ -787,7 +787,8 @@ ...@@ -787,7 +787,8 @@
self.time.start('datemaxrules'); self.time.start('datemaxrules');
jQuery.each (self.forms[formid].datemaxrules, function(r) { jQuery.each (self.forms[formid].datemaxrules, function(r) {
$form.find('#' + r).find('input, select').not('input[type=image]').each(function(){ $form.find('#' + r).find('input, select').not('input[type=image]').each(function(){
var rule = self.forms[formid].datemaxrules[r]; // Make sure we are working with the copy of rules object.
var rule = jQuery.extend(true, {}, self.forms[formid].datemaxrules[r]);
if (typeof self.validators[formid].settings.messages[r] === 'undefined') { if (typeof self.validators[formid].settings.messages[r] === 'undefined') {
self.validators[formid].settings.messages[r] = {}; self.validators[formid].settings.messages[r] = {};
} }
...@@ -802,7 +803,8 @@ ...@@ -802,7 +803,8 @@
if ('rules' in self.forms[formid]) { if ('rules' in self.forms[formid]) {
self.time.start('rules'); self.time.start('rules');
var rules = self.forms[formid].rules; // Make sure we are working with the copy of rules object.
var rules = jQuery.extend(true, {}, self.forms[formid].rules);
// :input can be slow, see http://jsperf.com/input-vs-input/2 // :input can be slow, see http://jsperf.com/input-vs-input/2
$form.find('input, textarea, select').each(function(idx, elem) { $form.find('input, textarea, select').each(function(idx, elem) {
var rule = rules[elem.name]; var rule = rules[elem.name];
......
...@@ -30,7 +30,7 @@ function clientside_validation_js_alter(&$javascript) { ...@@ -30,7 +30,7 @@ function clientside_validation_js_alter(&$javascript) {
$clientside_validation_settings['clientsideValidation']['general']['months'][t(date('F', $date))] = $month_number; $clientside_validation_settings['clientsideValidation']['general']['months'][t(date('F', $date))] = $month_number;
$clientside_validation_settings['clientsideValidation']['general']['months'][t(date('M', $date))] = $month_number; $clientside_validation_settings['clientsideValidation']['general']['months'][t(date('M', $date))] = $month_number;
} }
$javascript['settings']['data'][] = $clientside_validation_settings; drupal_add_js($clientside_validation_settings, 'setting');
} }
function clientside_validation_ajax_render_alter(&$commands) { function clientside_validation_ajax_render_alter(&$commands) {
......
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