Skip to content

Commit

Permalink
2.5.3 - bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
benkeen committed Nov 1, 2014
1 parent 8c9a07b commit efcc189
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 24 deletions.
3 changes: 2 additions & 1 deletion gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ module.exports = function(grunt) {
},
options: {
report: "min",
compress: true
compress: true,
banner: '// rsv.js - Really Simple Validation\n// v2.5.3, Nov 1 2014\n// https://github.com/benkeen/rsv\n'
}
}
}
Expand Down
9 changes: 1 addition & 8 deletions jquery/example_7_custom_error_handler.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,7 @@
document.getElementById(fieldName + "_error").innerHTML = errorInfo[i][1];
}

// normally, we'd do something like this: only return TRUE if there were no errors.
// but this is just a demo. so it's commented out.
//return (errorInfo.length == 0) ? true : false;

if (errorInfo.length == 0)
alert("Form submitted here!");

return false;
return (errorInfo.length == 0);
}

var myRules = [
Expand Down
9 changes: 6 additions & 3 deletions jquery/jquery.rsv.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* rsv.js - Really Simple Validation
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* v2.5.1, Nov 14 2008
* v2.5.3, Nov 1 2014
*
* This powerful little script lets you add client-side validation to any webform with very little
* work. It includes a number of pre-existing routines for common tasks like validating email
Expand Down Expand Up @@ -558,8 +558,11 @@


// if the user has defined a custom event handler, pass the information to it
if (typeof options.customErrorHandler == 'function')
return options.customErrorHandler(form, returnHash);
if (typeof options.customErrorHandler == 'function') {
if (!options.customErrorHandler(form, returnHash)) {
return false;
}
}

// if the user has chosen "alert-all" or "return-errors", perform the appropriate action
else if (options.displayType == "alert-all")
Expand Down
5 changes: 4 additions & 1 deletion jquery/jquery.rsv.min.js

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions prototype/prototype.rsv.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* rsv.js - Really Simple Validation
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* v2.5.1, Nov 14 2008
* v2.5.3, Nov 1 2014
*
* This powerful little script lets you add client-side validation to any webform with very little
* work. It includes a number of pre-existing routines for common tasks like validating email
Expand Down Expand Up @@ -546,9 +546,10 @@ RSV.prototype = {


// if the user has defined a custom event handler, pass the information to it
if (typeof this.options.customErrorHandler == 'function')
{
return this.options.customErrorHandler(form, this.returnHash);
if (typeof this.options.customErrorHandler == 'function') {
if (!this.options.customErrorHandler(form, this.returnHash)) {
return false;
}
}

// if the user has chosen "alert-all" or "return-errors", perform the appropriate action
Expand Down
5 changes: 4 additions & 1 deletion prototype/prototype.rsv.min.js

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions standalone/rsv.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* rsv.js - Really Simple Validation
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* v2.5.2, Jan 30 2010
* v2.5.3, Nov 1 2014
*
* This powerful little script lets you add client-side validation to any webform with very little
* work. It includes a number of pre-existing routines for common tasks like validating email
Expand All @@ -13,9 +13,9 @@
* This script is written by Ben Keen with additional code contributed by Mihai Ionescu and Nathan
* Howard. It is free to distribute, to re-write, spread on your toast - do what ever you want with it!
*/

{
if (typeof rsv == 'undefined')
rsv = {};
rsv = {};}


// SETTINGS
Expand Down Expand Up @@ -529,8 +529,11 @@ rsv.validate = function(form, rules)


// if the user has defined a custom event handler, pass the information to it
if (typeof rsv.customErrorHandler == 'function')
return rsv.customErrorHandler(form, rsv.returnHash);
if (typeof rsv.customErrorHandler == 'function') {
if (!rsv.customErrorHandler(form, rsv.returnHash)) {
return false;
}
}

// if the user has chosen "alert-all" or "return-errors", perform the appropriate action
else if (rsv.displayType == "alert-all")
Expand Down
5 changes: 4 additions & 1 deletion standalone/rsv.min.js

Large diffs are not rendered by default.

0 comments on commit efcc189

Please sign in to comment.