From bc78a4c90c9df77491b3c2e67f036d6bebe931e4 Mon Sep 17 00:00:00 2001 From: Gmajoulet Date: Wed, 15 May 2013 14:28:36 +0200 Subject: [PATCH] Tests and docs for binding the validation to any DOM element --- dist/parsley-standalone.min.js | 4 ++-- dist/parsley.extend.min.js | 2 +- dist/parsley.min.js | 4 ++-- documentation.html | 7 ++++++- tests/index.html | 4 ++++ tests/tests.js | 7 +++++-- 6 files changed, 20 insertions(+), 8 deletions(-) diff --git a/dist/parsley-standalone.min.js b/dist/parsley-standalone.min.js index e60724330..e51636c74 100644 --- a/dist/parsley-standalone.min.js +++ b/dist/parsley-standalone.min.js @@ -1,4 +1,4 @@ -/* Parsley dist/parsley-standalone.min.js build version 1.1.16 http://parsleyjs.org */ +/* Parsley dist/parsley-standalone.min.js build version 1.1.17-dev http://parsleyjs.org */ (function(b){String.prototype.trim===b&&(String.prototype.trim=function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")});Array.prototype.reduce===b&&(Array.prototype.reduce=function(l){if(void 0===this||null===this)throw new TypeError;var q=Object(this),p=q.length>>>0,m=0,a;if("function"!=typeof l)throw new TypeError;if(0==p&&1==arguments.length)throw new TypeError;if(2<=arguments.length)a=arguments[1];else{do{if(m in q){a=q[m++];break}if(++m>=p)throw new TypeError;}while(1)}for(;m",errorElem:"
  • "},listeners:{onFieldValidate:function(){return!1},onFormSubmit:function(){},onFieldError:function(){},onFieldSuccess:function(){}}};b(window).on("load",function(){b('[data-validate="parsley"]').each(function(){b(this).parsley()})})}(window.jQuery|| window.Zepto); diff --git a/dist/parsley.extend.min.js b/dist/parsley.extend.min.js index a301110bd..e00f99243 100644 --- a/dist/parsley.extend.min.js +++ b/dist/parsley.extend.min.js @@ -1,4 +1,4 @@ -/* Parsley dist/parsley.extend.min.js build version 1.1.16 http://parsleyjs.org */ +/* Parsley dist/parsley.extend.min.js build version 1.1.17-dev http://parsleyjs.org */ window.ParsleyConfig=window.ParsleyConfig||{}; (function(d){window.ParsleyConfig=d.extend(!0,{},window.ParsleyConfig,{validators:{minwords:function(a,b){a=a.replace(/(^\s*)|(\s*$)/gi,"");a=a.replace(/[ ]{2,}/gi," ");a=a.replace(/\n /,"\n");a=a.split(" ").length;return a>=b},maxwords:function(a,b){a=a.replace(/(^\s*)|(\s*$)/gi,"");a=a.replace(/[ ]{2,}/gi," ");a=a.replace(/\n /,"\n");a=a.split(" ").length;return a<=b},rangewords:function(a,b){a=a.replace(/(^\s*)|(\s*$)/gi,"");a=a.replace(/[ ]{2,}/gi," ");a=a.replace(/\n /,"\n");a=a.split(" ").length; return a>=b[0]&&a<=b[1]},greaterthan:function(a,b,c){c.options.validateIfUnchanged=!0;return new Number(a)>new Number(d(b).val())},lessthan:function(a,b,c){c.options.validateIfUnchanged=!0;return new Number(a)",errorElem:"
  • "},listeners:{onFieldValidate:function(){return!1},onFormSubmit:function(){},onFieldError:function(){},onFieldSuccess:function(){}}};d(window).on("load",function(){d('[data-validate="parsley"]').each(function(){d(this).parsley()})})}(window.jQuery|| window.Zepto); diff --git a/documentation.html b/documentation.html index 7c0a4699e..5f44dc6a4 100644 --- a/documentation.html +++ b/documentation.html @@ -304,7 +304,12 @@

    Properties

    - + + data-bind + + The attribute data-validate must be used on a form. However, if you want to bind the validation to another DOM element, just add this attribute and set it to true + + diff --git a/tests/index.html b/tests/index.html index 3d5c1f658..19fb1ef58 100644 --- a/tests/index.html +++ b/tests/index.html @@ -250,6 +250,10 @@ + +
    + +