From f3eecb30501ee5bec3a7d288b59649719dd3f244 Mon Sep 17 00:00:00 2001 From: Steve Wasiura Date: Tue, 23 Sep 2014 15:53:16 -0400 Subject: [PATCH 1/2] server validation, stop removal of attr holding err msg if server side validation does not return a specific message, don't remove the element attribute that holds a validation error message. this allows the failure of the server side validation to use the err msg specified in the element's attr. the specification of error messages may be in the domain / control of the web designer / form builder, and not the server side programmer. furthermore, the data validation error message attr of the active element may need to be used by other validation routines, and if attr is removed, other validation err msgs would appear blank. --- form-validator/security.dev.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/form-validator/security.dev.js b/form-validator/security.dev.js index 0cd3f8e..db3c7ad 100644 --- a/form-validator/security.dev.js +++ b/form-validator/security.dev.js @@ -337,8 +337,6 @@ $element.valAttr('backend-invalid', 'true'); if(response.message) $element.attr(conf.validationErrorMsgAttribute, response.message); - else - $element.removeAttr(conf.validationErrorMsgAttribute); } if( !$element.valAttr('has-keyup-event') ) { From 7602d0cb07f95e1468f1883318a685255bb1b028 Mon Sep 17 00:00:00 2001 From: Steve Wasiura Date: Tue, 23 Sep 2014 17:46:55 -0400 Subject: [PATCH 2/2] server success, don't remove attr on keyup same as previous edit, don't remove attribute first time field is validated at the server, server returns null message so newer code using inline err msg. works good. then when editing input element value, on keyup event, attr holding the inline err msg is removed, and when server returns validation error with no message, the err displayed to user is blank, since the inline err msg has been removed previously. --- form-validator/security.dev.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/form-validator/security.dev.js b/form-validator/security.dev.js index db3c7ad..f454f45 100644 --- a/form-validator/security.dev.js +++ b/form-validator/security.dev.js @@ -13,7 +13,7 @@ * - cvv * * @website http://formvalidator.net/#security-validators - * @version 2.2.beta.13 + * @version 2.2.beta.14 */ (function($, window) { @@ -347,7 +347,7 @@ $(this) .valAttr('backend-valid', false) .valAttr('backend-invalid', false) - .removeAttr(conf.validationErrorMsgAttribute); + ; } }); }