Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

No commit message

  • Loading branch information...
commit ce7c5baa4e513d5fe168c315c47cab25a1ea4f80 0 parents
@jzaefferer authored
Showing with 19,808 additions and 0 deletions.
  1. +236 −0 additional-methods.js
  2. +207 −0 changelog.txt
  3. +86 −0 demo/ajaxSubmit-intergration-demo.html
  4. +27 −0 demo/captcha/captcha.js
  5. BIN  demo/captcha/fonts/Anorexia.ttf
  6. +6 −0 demo/captcha/image_req.php
  7. +1 −0  demo/captcha/images/.htaccess
  8. BIN  demo/captcha/images/button.png
  9. BIN  demo/captcha/images/button.psd
  10. +35 −0 demo/captcha/images/image.php
  11. +66 −0 demo/captcha/index.php
  12. +12 −0 demo/captcha/newsession.php
  13. +14 −0 demo/captcha/process.php
  14. +11 −0 demo/captcha/rand.php
  15. +140 −0 demo/captcha/style.css
  16. +15 −0 demo/css/chili.css
  17. +46 −0 demo/css/cmxform.css
  18. +55 −0 demo/css/cmxformTemplate.css
  19. +21 −0 demo/css/core.css
  20. +61 −0 demo/css/reset.css
  21. +11 −0 demo/css/screen.css
  22. +95 −0 demo/custom-messages-metadata-demo.html
  23. +123 −0 demo/custom-methods-demo.html
  24. +151 −0 demo/dynamic-totals.html
  25. +162 −0 demo/errorcontainer-demo.html
  26. +55 −0 demo/example.html
  27. +10 −0 demo/form.php
  28. +10 −0 demo/form.phps
  29. BIN  demo/images/bg.gif
  30. BIN  demo/images/checked.gif
  31. BIN  demo/images/cmxform-divider.gif
  32. BIN  demo/images/cmxform-fieldset.gif
  33. BIN  demo/images/loading.gif
  34. BIN  demo/images/unchecked.gif
  35. +235 −0 demo/index.html
  36. +1 −0  demo/js/chili-1.7.pack.js
  37. +24 −0 demo/js/cmxforms.js
  38. BIN  demo/login/images/bg.gif
  39. BIN  demo/login/images/header1.jpg
  40. BIN  demo/login/images/page.gif
  41. BIN  demo/login/images/required_star.gif
  42. +76 −0 demo/login/index.html
  43. +457 −0 demo/login/screen.css
  44. +10 −0 demo/marketo/emails.php
  45. +10 −0 demo/marketo/emails.phps
  46. +35 −0 demo/marketo/ie6.css
  47. BIN  demo/marketo/images/backRequiredGray.gif
  48. BIN  demo/marketo/images/back_green-fade.gif
  49. BIN  demo/marketo/images/back_nav_blue.gif
  50. BIN  demo/marketo/images/blank.gif
  51. BIN  demo/marketo/images/button-submit.gif
  52. BIN  demo/marketo/images/favicon.ico
  53. BIN  demo/marketo/images/help.png
  54. BIN  demo/marketo/images/left-nav-callout-long.png
  55. BIN  demo/marketo/images/login-sprite.gif
  56. BIN  demo/marketo/images/logo_marketo.gif
  57. BIN  demo/marketo/images/sf.png
  58. BIN  demo/marketo/images/step1-24.gif
  59. BIN  demo/marketo/images/step2-24.gif
  60. BIN  demo/marketo/images/step3-24.gif
  61. BIN  demo/marketo/images/tab-sprite.gif
  62. BIN  demo/marketo/images/tab_green.gif
  63. BIN  demo/marketo/images/time.png
  64. BIN  demo/marketo/images/toggle.gif
  65. BIN  demo/marketo/images/warning.gif
  66. +247 −0 demo/marketo/index.html
  67. +267 −0 demo/marketo/jquery.maskedinput.js
  68. +125 −0 demo/marketo/mktSignup.js
  69. +291 −0 demo/marketo/step2.htm
  70. +1,179 −0 demo/marketo/stylesheet.css
  71. BIN  demo/milk/bg.gif
  72. +10 −0 demo/milk/emails.php
  73. +10 −0 demo/milk/emails.phps
  74. +235 −0 demo/milk/index.html
  75. BIN  demo/milk/left_white.png
  76. +236 −0 demo/milk/milk.css
  77. BIN  demo/milk/milk.png
  78. BIN  demo/milk/right_white.png
  79. +12 −0 demo/milk/users.php
  80. +10 −0 demo/milk/users.phps
  81. +412 −0 demo/multipart/index.html
  82. +246 −0 demo/multipart/js/jquery.maskedinput-1.0.js
  83. +477 −0 demo/multipart/js/ui.accordion.js
  84. +519 −0 demo/multipart/js/ui.core.js
  85. +705 −0 demo/multipart/style.css
  86. +160 −0 demo/radio-checkbox-select-demo.html
  87. +157 −0 demo/tabs/index.html
  88. +75 −0 demo/tinymce/index.html
  89. +1 −0  demo/tinymce/themes/simple/editor_template.js
  90. BIN  demo/tinymce/themes/simple/img/icons.gif
  91. +11 −0 demo/tinymce/themes/simple/langs/en.js
  92. +32 −0 demo/tinymce/themes/simple/skins/default/ui.css
  93. +1 −0  demo/tinymce/tiny_mce.js
  94. +1,131 −0 jquery.validate.js
  95. +16 −0 jquery.validate.min.js
  96. +15 −0 jquery.validate.pack.js
  97. BIN  jquery.validate.zip
  98. +819 −0 lib/jquery.form.js
  99. +4,241 −0 lib/jquery.js
  100. +122 −0 lib/jquery.metadata.js
  101. +25 −0 localization/messages_bg.js
  102. +24 −0 localization/messages_cn.js
  103. +23 −0 localization/messages_cs.js
  104. +21 −0 localization/messages_da.js
  105. +21 −0 localization/messages_de.js
  106. +24 −0 localization/messages_es.js
  107. +23 −0 localization/messages_fi.js
  108. +23 −0 localization/messages_fr.js
  109. +21 −0 localization/messages_hu.js
  110. +26 −0 localization/messages_it.js
  111. +23 −0 localization/messages_kk.js
  112. +23 −0 localization/messages_nl.js
  113. +23 −0 localization/messages_no.js
  114. +23 −0 localization/messages_pl.js
  115. +30 −0 localization/messages_ptbr.js
  116. +24 −0 localization/messages_ro.js
  117. +23 −0 localization/messages_ru.js
  118. +23 −0 localization/messages_se.js
  119. +21 −0 localization/messages_sk.js
  120. +24 −0 localization/messages_tr.js
  121. +24 −0 localization/messages_tw.js
  122. +24 −0 localization/messages_ua.js
  123. +71 −0 test/events.html
  124. BIN  test/firebug/errorIcon.png
  125. +209 −0 test/firebug/firebug.css
  126. +23 −0 test/firebug/firebug.html
  127. +672 −0 test/firebug/firebug.js
  128. +10 −0 test/firebug/firebugx.js
  129. BIN  test/firebug/infoIcon.png
  130. BIN  test/firebug/warningIcon.png
  131. +261 −0 test/index.html
  132. +188 −0 test/large.html
  133. +62 −0 test/messages.js
  134. +553 −0 test/methods.js
  135. +803 −0 test/qunit/testrunner.js
  136. +120 −0 test/qunit/testsuite.css
  137. +267 −0 test/rules.js
  138. +444 −0 test/selects/index.html
  139. +78 −0 test/tabs.html
  140. +1,071 −0 test/test.js
  141. +11 −0 test/users.php
  142. +11 −0 test/users2.php
  143. +172 −0 todo
236 additional-methods.js
@@ -0,0 +1,236 @@
+jQuery.validator.addMethod("maxWords", function(value, element, params) {
+ return this.optional(element) || value.match(/\b\w+\b/g).length < params;
+}, jQuery.validator.format("Please enter {0} words or less."));
+
+jQuery.validator.addMethod("minWords", function(value, element, params) {
+ return this.optional(element) || value.match(/\b\w+\b/g).length >= params;
+}, jQuery.validator.format("Please enter at least {0} words."));
+
+jQuery.validator.addMethod("rangeWords", function(value, element, params) {
+ return this.optional(element) || value.match(/\b\w+\b/g).length >= params[0] && value.match(/bw+b/g).length < params[1];
+}, jQuery.validator.format("Please enter between {0} and {1} words."));
+
+
+jQuery.validator.addMethod("letterswithbasicpunc", function(value, element) {
+ return this.optional(element) || /^[a-z-.,()'\"\s]+$/i.test(value);
+}, "Letters or punctuation only please");
+
+jQuery.validator.addMethod("alphanumeric", function(value, element) {
+ return this.optional(element) || /^\w+$/i.test(value);
+}, "Letters, numbers, spaces or underscores only please");
+
+jQuery.validator.addMethod("lettersonly", function(value, element) {
+ return this.optional(element) || /^[a-z]+$/i.test(value);
+}, "Letters only please");
+
+jQuery.validator.addMethod("nowhitespace", function(value, element) {
+ return this.optional(element) || /^\S+$/i.test(value);
+}, "No white space please");
+
+jQuery.validator.addMethod("ziprange", function(value, element) {
+ return this.optional(element) || /^90[2-5]\d\{2}-\d{4}$/.test(value);
+}, "Your ZIP-code must be in the range 902xx-xxxx to 905-xx-xxxx");
+
+/**
+* Return true, if the value is a valid vehicle identification number (VIN).
+*
+* Works with all kind of text inputs.
+*
+* @example <input type="text" size="20" name="VehicleID" class="{required:true,vinUS:true}" />
+* @desc Declares a required input element whose value must be a valid vehicle identification number.
+*
+* @name jQuery.validator.methods.vinUS
+* @type Boolean
+* @cat Plugins/Validate/Methods
+*/
+jQuery.validator.addMethod(
+ "vinUS",
+ function(v){
+ if (v.length != 17)
+ return false;
+ var i, n, d, f, cd, cdv;
+ var LL = ["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"];
+ var VL = [1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9];
+ var FL = [8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2];
+ var rs = 0;
+ for(i = 0; i < 17; i++){
+ f = FL[i];
+ d = v.slice(i,i+1);
+ if(i == 8){
+ cdv = d;
+ }
+ if(!isNaN(d)){
+ d *= f;
+ }
+ else{
+ for(n = 0; n < LL.length; n++){
+ if(d.toUpperCase() === LL[n]){
+ d = VL[n];
+ d *= f;
+ if(isNaN(cdv) && n == 8){
+ cdv = LL[n];
+ }
+ break;
+ }
+ }
+ }
+ rs += d;
+ }
+ cd = rs % 11;
+ if(cd == 10){cd = "X";}
+ if(cd == cdv){return true;}
+ return false;
+ },
+ "The specified vehicle identification number (VIN) is invalid."
+);
+
+/**
+ * Return true, if the value is a valid date, also making this formal check dd/mm/yyyy.
+ *
+ * @example jQuery.validator.methods.date("01/01/1900")
+ * @result true
+ *
+ * @example jQuery.validator.methods.date("01/13/1990")
+ * @result false
+ *
+ * @example jQuery.validator.methods.date("01.01.1900")
+ * @result false
+ *
+ * @example <input name="pippo" class="{dateITA:true}" />
+ * @desc Declares an optional input element whose value must be a valid date.
+ *
+ * @name jQuery.validator.methods.dateITA
+ * @type Boolean
+ * @cat Plugins/Validate/Methods
+ */
+jQuery.validator.addMethod(
+ "dateITA",
+ function(value, element) {
+ var check = false;
+ var re = /^\d{1,2}\/\d{1,2}\/\d{4}$/
+ if( re.test(value)){
+ var adata = value.split('/');
+ var gg = parseInt(adata[0],10);
+ var mm = parseInt(adata[1],10);
+ var aaaa = parseInt(adata[2],10);
+ var xdata = new Date(aaaa,mm-1,gg);
+ if ( ( xdata.getFullYear() == aaaa ) && ( xdata.getMonth () == mm - 1 ) && ( xdata.getDate() == gg ) )
+ check = true;
+ else
+ check = false;
+ } else
+ check = false;
+ return this.optional(element) || check;
+ },
+ "Please enter a correct date"
+);
+
+jQuery.validator.addMethod("dateNL", function(value, element) {
+ return this.optional(element) || /^\d\d?[\.\/-]\d\d?[\.\/-]\d\d\d?\d?$/.test(value);
+ }, "Vul hier een geldige datum in."
+);
+
+jQuery.validator.addMethod("time", function(value, element) {
+ return this.optional(element) || /^([01][0-9])|(2[0123]):([0-5])([0-9])$/.test(value);
+ }, "Please enter a valid time, between 00:00 and 23:59"
+);
+
+/**
+ * matches US phone number format
+ *
+ * where the area code may not start with 1 and the prefix may not start with 1
+ * allows '-' or ' ' as a separator and allows parens around area code
+ * some people may want to put a '1' in front of their number
+ *
+ * 1(212)-999-2345
+ * or
+ * 212 999 2344
+ * or
+ * 212-999-0983
+ *
+ * but not
+ * 111-123-5434
+ * and not
+ * 212 123 4567
+ */
+jQuery.validator.addMethod("phone", function(phone_number, element) {
+ phone_number = phone_number.replace(/\s+/g, "");
+ return this.optional(element) || phone_number.length > 9 &&
+ phone_number.match(/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/);
+}, "Please specify a valid phone number");
+
+// TODO check if value starts with <, otherwise don't try stripping anything
+jQuery.validator.addMethod("strippedminlength", function(value, element, param) {
+ return jQuery(value).text().length >= param;
+}, jQuery.validator.format("Please enter at least {0} characters"));
+
+// same as email, but TLD is optional
+jQuery.validator.addMethod("email2", function(value, element, param) {
+ return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);
+}, jQuery.validator.messages.email);
+
+// same as url, but TLD is optional
+jQuery.validator.addMethod("url2", function(value, element, param) {
+ return this.optional(element) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);
+}, jQuery.validator.messages.url);
+
+// NOTICE: Modified version of Castle.Components.Validator.CreditCardValidator
+// Redistributed under the the Apache License 2.0 at http://www.apache.org/licenses/LICENSE-2.0
+// Valid Types: mastercard, visa, amex, dinersclub, enroute, discover, jcb, unknown, all (overrides all other settings)
+jQuery.validator.addMethod("creditcardtypes", function(value, element, param) {
+
+ if (/[^0-9-]+/.test(value))
+ return false;
+
+ value = value.replace(/\D/g, "");
+
+ var validTypes = 0x0000;
+
+ if (param.mastercard)
+ validTypes |= 0x0001;
+ if (param.visa)
+ validTypes |= 0x0002;
+ if (param.amex)
+ validTypes |= 0x0004;
+ if (param.dinersclub)
+ validTypes |= 0x0008;
+ if (param.enroute)
+ validTypes |= 0x0010;
+ if (param.discover)
+ validTypes |= 0x0020;
+ if (param.jcb)
+ validTypes |= 0x0040;
+ if (param.unknown)
+ validTypes |= 0x0080;
+ if (param.all)
+ validTypes = 0x0001 | 0x0002 | 0x0004 | 0x0008 | 0x0010 | 0x0020 | 0x0040 | 0x0080;
+
+ if (validTypes & 0x0001 && /^(51|52|53|54|55)/.test(value)) { //mastercard
+ return value.length == 16;
+ }
+ if (validTypes & 0x0002 && /^(4)/.test(value)) { //visa
+ return value.length == 16;
+ }
+ if (validTypes & 0x0004 && /^(34|37)/.test(value)) { //amex
+ return value.length == 15;
+ }
+ if (validTypes & 0x0008 && /^(300|301|302|303|304|305|36|38)/.test(value)) { //dinersclub
+ return value.length == 14;
+ }
+ if (validTypes & 0x0010 && /^(2014|2149)/.test(value)) { //enroute
+ return value.length == 15;
+ }
+ if (validTypes & 0x0020 && /^(6011)/.test(value)) { //discover
+ return value.length == 16;
+ }
+ if (validTypes & 0x0040 && /^(3)/.test(value)) { //jcb
+ return value.length == 16;
+ }
+ if (validTypes & 0x0040 && /^(2131|1800)/.test(value)) { //jcb
+ return value.length == 15;
+ }
+ if (validTypes & 0x0080) { //unknown
+ return true;
+ }
+ return false;
+}, "Please enter a valid credit card number.");
207 changelog.txt
@@ -0,0 +1,207 @@
+next
+---
+* Added Finnish (FI) and Bulgarian (BR) localization
+
+1.5.5
+---
+* Fix for http://plugins.jquery.com/node/8659
+* Fixed trailing comma in messages_cs.js
+
+1.5.4
+---
+* Fixed remote method bug (http://plugins.jquery.com/node/8658)
+
+1.5.3
+---
+* Fixed a bug related to the wrapper-option, where all ancestor-elements that matched the wrapper-option where selected (http://plugins.jquery.com/node/7624)
+* Updated multipart demo to use latest jQuery UI accordion
+* Added dateNL and time methods to additionalMethods.js
+* Added Traditional Chinese (Taiwan, tw) and Kazakhstan (KK) localization
+* Moved jQuery.format (fomerly String.format) to jQuery.validator.format, jQuery.format is deprecated and will be removed in 1.6 (see http://code.google.com/p/jquery-utils/issues/detail?id=15 for details)
+* Cleaned up messages_pl.js and messages_ptbr.js (still defined messages for max/min/rangeValue, which were removed in 1.4)
+* Fixed flawed boolean logic in valid-plugin-method for multiple elements; now all elements need to be valid for a boolean-true result (http://plugins.jquery.com/node/8481)
+* Enhancement $.validator.addMethod: An undefined third message-argument won't overwrite an existing message (http://plugins.jquery.com/node/8443)
+* Enhancement to submitHandler option: When used, click events on submit buttons are captured and the submitting button is inserted into the form before calling submitHandler, and removed afterwards; keeps submit buttons intact (http://plugins.jquery.com/node/7183#comment-3585)
+* Added option validClass, default "valid", which adds that class to all valid elements, after validation (http://dev.jquery.com/ticket/2205)
+* Added creditcardtypes method to additionalMethods.js, including tests (via http://dev.jquery.com/ticket/3635)
+* Improved remote method to allow serverside message as a string, or true for valid, or false for invalid using the clientside defined message (http://dev.jquery.com/ticket/3807)
+* Improved accept method to also accept a Drupal-style comma-seperated list of values (http://plugins.jquery.com/node/8580)
+
+1.5.2
+---
+* Fixed messages in additional-methods.js for maxWords, minWords, and rangeWords to include call to $.format
+* Fixed value passed to methods to exclude carriage return (\r), same as jQuery's val() does
+* Added slovak (sk) localization
+* Added demo for intergration with jQuery UI tabs
+* Added selects-grouping example to tabs demo (see second tab, birthdate field)
+
+1.5.1
+---
+* Updated marketo demo to use invalidHandler option instead of binding invalid-form event
+* Added TinyMCE integration example
+* Added ukrainian (ua) localization
+* Fixed length validation to work with trimmed value (regression from 1.5 where general trimming before validation was removed)
+* Various small fixes for compability with both 1.2.6 and 1.3
+
+1.5
+---
+* Improved basic demo, validating confirm-password field after password changed
+* Fixed basic validation to pass the untrimmed input value as the first parameter to validation methods, changed required accordingly; breaks existing custom method that rely on the trimming
+* Added norwegian (no), italian (it), hungarian (hu) and romanian (ro) localization
+* Fixed #3195: Two flaws in swedish localization
+* Fixed #3503: Extended rules("add") to accept messages propery: use to specify add custom messages to an element via rules("add", { messages: { required: "Required! " } });
+* Fixed #3356: Regression from #2908 when using meta-option
+* Fixed #3370: Added ignoreTitle option, set to skip reading messages from the title attribute, helps to avoid issues with Google Toolbar; default is false for compability
+* Fixed #3516: Trigger invalid-form event even when remote validation is involved
+* Added invalidHandler option as a shortcut to bind("invalid-form", function() {})
+* Fixed Safari issue for loading indicator in ajaxSubmit-integration-demo (append to body first, then hide)
+* Added test for creditcard validation and improved default message
+* Enhanced remote validation, accepting options to passthrough to $.ajax as paramter (either url string or options, including url property plus everything else that $.ajax supports)
+
+1.4
+---
+* Fixed #2931, validate elements in document order and ignore type=image inputs
+* Fixed usage of $ and jQuery variables, now fully comptible with all variations of noConflict usage
+* Implemented #2908, enabling custom messages via metadata ala class="{required:true,messages:{required:'required field'}}", added demo/custom-messages-metadata-demo.html
+* Removed deprecated methods minValue (min), maxValue (max), rangeValue (rangevalue), minLength (minlength), maxLength (maxlength), rangeLength (rangelength)
+* Fixed #2215 regression: Call unhighlight only for current elements, not everything
+* Implemented #2989, enabling image button to cancel validation
+* Fixed issue where IE incorrectly validates against maxlength=0
+* Added czech (cs) localization
+* Reset validator.submitted on validator.resetForm(), enabling a full reset when necessary
+* Fixed #3035, skipping all falsy attributes when reading rules (0, undefined, empty string), removed part of the maxlength workaround (for 0)
+* Added dutch (nl) localization (#3201)
+
+1.3
+---
+* Fixed invalid-form event, now only triggered when form is invalid
+* Added spanish (es), russian (ru), portuguese brazilian (ptbr), turkish (tr), and polish (pl) localization
+* Added removeAttrs plugin to facilate adding and removing multiple attributes
+* Added groups option to display a single message for multiple elements, via groups: { arbitraryGroupName: "fieldName1 fieldName2[, fieldNameN" }
+* Enhanced rules() for adding and removing (static) rules: rules("add", "method1[, methodN]"/{method1:param[, method_n:param]}) and rules("remove"[, "method1[, method_n]")
+* Enhanced rules-option, accepts space-seperated string-list of methods, eg. {birthdate: "required date"}
+* Fixed checkbox group validation with inline rules: As long as the rules are specified on the first element, the group is now properly validated on click
+* Fixed #2473, ignoring all rules with an explicit parameter of boolean-false, eg. required:false is the same as not specifying required at all (it was handled as required:true so far)
+* Fixed #2424, with a modified patch from #2473: Methods returning a dependency-mismatch don't stop other rules from being evaluated anymore; still, success isn't applied for optional fields
+* Fixed url and email validation to not use trimmed values
+* Fixed creditcard validation to accept only digits and dashes ("asdf" is not a valid creditcard number)
+* Allow both button and input elements for cancel buttons (via class="cancel")
+* Fixed #2215: Fixed message display to call unhighlight as part of showing and hiding messages, no more visual side-effects while checking an element and extracted validator.checkForm to validate a form without UI sideeffects
+* Rewrote custom selectors (:blank, :filled, :unchecked) with functions for compability with AIR
+
+1.2.1
+-----
+
+* Bundled delegeate plugin with validate plugin - its always required anyway
+* Improved remote validation to include parts from the ajaxQueue plugin for proper synchronization (no additional plugin necessary)
+* Fixed stopRequest to prevent pendingRequest < 0
+* Added jQuery.validator.autoCreateRanges property, defaults to false, enable to convert min/max to range and minlength/maxlength to rangelength; this basically fixes the issue introduced by automatically creating ranges in 1.2
+* Fixed optional-methods to not highlight anything at all if the field is blank, that is, don't trigger success
+* Allow false/null for highlight/unhighlight options instead of forcing a do-nothing-callback even when nothing needs to be highlighted
+* Fixed validate() call with no elements selected, returning undefined instead of throwing an error
+* Improved demo, replacing metadata with classes/attributes for specifying rules
+* Fixed error when no custom message is used for remote validation
+* Modified email and url validation to require domain label and top label
+* Fixed url and email validation to require TLD (actually to require domain label); 1.2 version (TLD is optional) is moved to additionals as url2 and email2
+* Fixed dynamic-totals demo in IE6/7 and improved templating, using textarea to store multiline template and string interpolation
+* Added login form example with "Email password" link that makes the password field optional
+* Enhanced dynamic-totals demo with an example of a single message for two fields
+
+1.2
+---
+
+* Added AJAX-captcha validation example (based on http://psyrens.com/captcha/)
+* Added remember-the-milk-demo (thanks RTM team for the permission!)
+* Added marketo-demo (thanks Glen Lipka!)
+* Added support for ajax-validation, see method "remote"; serverside returns JSON, true for valid elements, false or a String for invalid, String is used as message
+* Added highlight and unhighlight options, by default toggles errorClass on element, allows custom highlighting
+* Added valid() plugin method for easy programmatic checking of forms and fields without the need to use the validator API
+* Added rules() plguin method to read and write rules for an element (currently read only)
+* Replaced regex for email method, thanks to the contribution by Scott Gonzalez, see http://projects.scottsplayground.com/email_address_validation/
+* Restructured event architecture to rely solely on delegation, both improving performance, and ease-of-use for the developer (requires jquery.delegate.js)
+* Moved documentation from inline to http://docs.jquery.com/Plugins/Validation - including interactive examples for all methods
+* Removed validator.refresh(), validation is now completey dynamic
+* Renamed minValue to min, maxValue to max and rangeValue to range, deprecating the previous names (to be removed in 1.3)
+* Renamed minLength to minlength, maxLength to maxlength and rangeLength to rangelength, deprecating the previous names (to be removed in 1.3)
+* Added feature to merge min + max into and range and minlength + maxlength into rangelength
+* Added support for dynamic rule parameters, allowing to specify a function as a parameter eg. for minlength, called when validating the element
+* Allow to specify null or an empty string as a message to display nothing (see marketo demo)
+* Rules overhaul: Now supports combination of rules-option, metadata, classes (new) and attributes (new), see rules() for details
+
+1.1.2
+---
+
+* Replaced regex for URL method, thanks to the contribution by Scott Gonzalez, see http://projects.scottsplayground.com/iri/
+* Improved email method to better handle unicode characters
+* Fixed error container to hide when all elements are valid, not only on form submit
+* Fixed String.format to jQuery.format (moving into jQuery namespace)
+* Fixed accept method to accept both upper and lowercase extensions
+* Fixed validate() plugin method to create only one validator instance for a given form and always return that one instance (avoids binding events multiple times)
+* Changed debug-mode console log from "error" to "warn" level
+
+1.1.1
+-----
+
+* Fixed invalid XHTML, preventing error label creation in IE since jQuery 1.1.4
+* Fixed and improved String.format: Global search & replace, better handling of array arguments
+* Fixed cancel-button handling to use validator-object for storing state instead of form element
+* Fixed name selectors to handle "complex" names, eg. containing brackets ("list[]")
+* Added button and disabled elements to exclude from validation
+* Moved element event handlers to refresh to be able to add handlers to new elements
+* Fixed email validation to allow long top level domains (eg. ".travel")
+* Moved showErrors() from valid() to form()
+* Added validator.size(): returns the number of current errors
+* Call submitHandler with validator as scope for easier access of it's methods, eg. to find error labels using errorsFor(Element)
+* Compatible with jQuery 1.1.x and 1.2.x
+
+1.1
+---
+
+* Added validation on blur, keyup and click (for checkboxes and radiobutton). Replaces event-option.
+* Fixed resetForm
+* Fixed custom-methods-demo
+
+1.0
+---
+
+* Improved number and numberDE methods to check for correct decimal numbers with delimiters
+* Only elements that have rules are checked (otherwise success-option is applied to all elements)
+* Added creditcard number method (thanks to Brian Klug)
+* Added ignore-option, eg. ignore: "[@type=hidden]", using that expression to exclude elements to validate. Default: none, though submit and reset buttons are always ignored
+* Heavily enhanced Functions-as-messages by providing a flexible String.format helper
+* Accept Functions as messages, providing runtime-custom-messages
+* Fixed exclusion of elements without rules from successList
+* Fixed custom-method-demo, replaced the alert with message displaying the number of errors
+* Fixed form-submit-prevention when using submitHandler
+* Completely removed dependency on element IDs, though they are still used (when present) to link error labels to inputs. Achieved by using
+ an array with {name, message, element} instead of an object with id:message pairs for the internal errorList.
+* Added support for specifying simple rules as simple strings, eg. "required" is equivalent to {required: true}
+* Added feature: Add errorClass to invalid field�s parent element, making it easy to style the label/field container or the label for the field.
+* Added feature: focusCleanup - If enabled, removes the errorClass from the invalid elements and hides all errors messages whenever the element is focused.
+* Added success option to show the a field was validated successfully
+* Fixed Opera select-issue (avoiding a attribute-collision)
+* Fixed problems with focussing hidden elements in IE
+* Added feature to skip validation for submit buttons with class "cancel"
+* Fixed potential issues with Google Toolbar by prefering plugin option messages over title attribute
+* submitHandler is only called when an actual submit event was handled, validator.form() returns false only for invalid forms
+* Invalid elements are now focused only on submit or via validator.focusInvalid(), avoiding all trouble with focus-on-blur
+* IE6 error container layout issue is solved
+* Customize error element via errorElement option
+* Added validator.refresh() to find new inputs in the form
+* Added accept validation method, checks file extensions
+* Improved dependecy feature by adding two custom expressions: ":blank" to select elements with an empty value and �:filled� to select elements with a value, both excluding whitespace
+* Added a resetForm() method to the validator: Resets each form element (using the form plugin, if available), removes classes on invalid elements and hides all error messages
+* Fixed docs for validator.showErrors()
+* Fixed error label creation to always use html() instead of text(), allowing arbitrary HTML passed in as messages
+* Fixed error label creation to use specified error class
+* Added dependency feature: The requires method accepts both String (jQuery expressions) and Functions as the argument
+* Heavily improved customizing of error message display: Use normal messages and show/hide an additional container; Completely replace message display with own mechanism (while being able to delegate to the default handler; Customize placing of generated labels (instead of default below-element)
+* Fixed two major bugs in IE (error containers) and Opera (metadata)
+* Modified validation methods to accept empty fields as valid (exception: of course �required� and also �equalTo� methods)
+* Renamed "min" to "minLength", "max" to "maxLength", "length" to "rangeLength"
+* Added "minValue", "maxValue" and "rangeValue"
+* Streamlined API for support of different events. The default, submit, can be disabled. If any event is specified, that is applied to each element (instead of the entire form). Combining keyup-validation with submit-validation is now extremely easy to setup
+* Added support for one-message-per-rule when defining messages via plugin settings
+* Added support to wrap metadata in some parent element. Useful when metadata is used for other plugins, too.
+* Refactored tests and demos: Less files, better demos
+* Improved documentation: More examples for methods, more reference texts explaining some basics
86 demo/ajaxSubmit-intergration-demo.html
@@ -0,0 +1,86 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Test for jQuery validate() plugin</title>
+<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
+<style type="text/css">
+.warning { color: red; }
+</style>
+<script src="../lib/jquery.js" type="text/javascript"></script>
+<script src="../lib/jquery.form.js" type="text/javascript"></script>
+<script src="../jquery.validate.js" type="text/javascript"></script>
+
+<script src="js/cmxforms.js" type="text/javascript"></script>
+<script type="text/javascript">
+ jQuery(function() {
+ // show a simple loading indicator
+ var loader = jQuery('<div id="loader"><img src="images/loading.gif" alt="loading..." /></div>')
+ .css({position: "relative", top: "1em", left: "25em"})
+ .appendTo("body")
+ .hide();
+ jQuery().ajaxStart(function() {
+ loader.show();
+ }).ajaxStop(function() {
+ loader.hide();
+ }).ajaxError(function(a, b, e) {
+ throw e;
+ });
+
+ var v = jQuery("#form").validate({
+ submitHandler: function(form) {
+ jQuery(form).ajaxSubmit({
+ target: "#result"
+ });
+ }
+ });
+
+ jQuery("#reset").click(function() {
+ v.resetForm();
+ });
+ });
+</script>
+
+</head>
+<body>
+
+<h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">jQuery Validation Plugin</a> Demo</h1>
+<div id="main">
+
+<form method="post" class="cmxform" id="form" action="form.php">
+ <fieldset>
+ <legend>Login Form (Enter "foobar" as password)</legend>
+ <p>
+ <label for="user">Username</label>
+ <input id="user" name="user" title="Please enter your username (at least 3 characters)" class="required" minlength="3" />
+ </p>
+ <p>
+ <label for="pass">Password</label>
+ <input type="password" name="password" id="password" class="required" minlength"5" />
+ </p>
+ <p>
+ <input class="submit" type="submit" value="Login"/>
+ </p>
+ </fieldset>
+</form>
+
+<div id="result">Please login!</div>
+
+<br/>
+
+<button id="reset">Programmatically reset above form!</button>
+
+<p>Backend file: <a href="form.php">form.phps</a></p>
+
+<a href="index.html">Back to main page</a>
+
+</div>
+
+<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
+</script>
+<script type="text/javascript">
+_uacct = "UA-2623402-1";
+urchinTracker();
+</script>
+</body>
+</html>
27 demo/captcha/captcha.js
@@ -0,0 +1,27 @@
+$(function(){
+ $("#refreshimg").click(function(){
+ $.post('newsession.php');
+ $("#captchaimage").load('image_req.php');
+ return false;
+ });
+
+ $("#captchaform").validate({
+ rules: {
+ captcha: {
+ required: true,
+ remote: "process.php"
+ }
+ },
+ messages: {
+ captcha: "Correct captcha is required. Click the captcha to generate a new one"
+ },
+ submitHandler: function() {
+ alert("Correct captcha!");
+ },
+ success: function(label) {
+ label.addClass("valid").text("Valid captcha!")
+ },
+ onkeyup: false
+ });
+
+});
BIN  demo/captcha/fonts/Anorexia.ttf
Binary file not shown
6 demo/captcha/image_req.php
@@ -0,0 +1,6 @@
+<?php
+
+// Echo the image - timestamp appended to prevent caching
+echo '<a href="index.php" onclick="refreshimg(); return false;" title="Click to refresh image"><img src="images/image.jpg?' . time() . '" width="132" height="46" alt="Captcha image" /></a>';
+
+?>
1  demo/captcha/images/.htaccess
@@ -0,0 +1 @@
+AddType application/x-httpd-php .jpg
BIN  demo/captcha/images/button.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  demo/captcha/images/button.psd
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 demo/captcha/images/image.php
@@ -0,0 +1,35 @@
+<?php
+
+// Begin the session
+session_start();
+
+// If the session is not present, set the variable to an error message
+if(!isset($_SESSION['captcha_id']))
+ $str = 'ERROR!';
+// Else if it is present, set the variable to the session contents
+else
+ $str = $_SESSION['captcha_id'];
+
+// Set the content type
+//header('Content-type: image/png');
+header('Cache-control: no-cache');
+
+// Create an image from button.png
+$image = imagecreatefrompng('button.png');
+
+// Set the font colour
+$colour = imagecolorallocate($image, 183, 178, 152);
+
+// Set the font
+$font = '../fonts/Anorexia.ttf';
+
+// Set a random integer for the rotation between -15 and 15 degrees
+$rotate = rand(-15, 15);
+
+// Create an image using our original image and adding the detail
+imagettftext($image, 14, $rotate, 18, 30, $colour, $font, $str);
+
+// Output the image as a png
+imagepng($image);
+
+?>
66 demo/captcha/index.php
@@ -0,0 +1,66 @@
+<?php
+
+// Make the page validate
+ini_set('session.use_trans_sid', '0');
+
+// Include the random string file
+require 'rand.php';
+
+// Begin the session
+session_start();
+
+// Set the session contents
+$_SESSION['captcha_id'] = $str;
+
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+
+<head>
+ <title>AJAX CAPTCHA</title>
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
+ <meta name="keywords" content="AJAX,JHR,PHP,CAPTCHA,download,PHP CAPTCHA,AJAX CAPTCHA,AJAX PHP CAPTCHA,download AJAX CAPTCHA,download AJAX PHP CAPTCHA" />
+ <meta name="description" content="An AJAX CAPTCHA script, written in PHP" />
+
+ <script type="text/javascript" src="../../lib/jquery.js"></script>
+ <script type="text/javascript" src="../../jquery.validate.js"></script>
+ <script type="text/javascript" src="captcha.js"></script>
+
+ <link rel="stylesheet" type="text/css" href="style.css" />
+ <style type="text/css">
+ img { border: 1px solid #eee; }
+ p#statusgreen { font-size: 1.2em; background-color: #fff; color: #0a0; }
+ p#statusred { font-size: 1.2em; background-color: #fff; color: #a00; }
+ fieldset label { display: block; }
+ fieldset div#captchaimage { float: left; margin-right: 15px; }
+ fieldset input#captcha { width: 25%; border: 1px solid #ddd; padding: 2px; }
+ fieldset input#submit { display: block; margin: 2% 0% 0% 0%; }
+ #captcha.success {
+ border: 1px solid #49c24f;
+ background: #bcffbf;
+ }
+ #captcha.error {
+ border: 1px solid #c24949;
+ background: #ffbcbc;
+ }
+ </style>
+</head>
+
+<body>
+
+<h1><acronym title="Asynchronous JavaScript And XML">AJAX</acronym> <acronym title="Completely Automated Public Turing test to tell Computers and Humans Apart">CAPTCHA</acronym>, based on <a href="http://psyrens.com/captcha/">http://psyrens.com/captcha/</a></h1>
+
+<form id="captchaform" action="">
+<fieldset>
+ <div id="captchaimage"><a href="<?php echo $_SERVER['PHP_SELF']; ?>" id="refreshimg" title="Click to refresh image"><img src="images/image.php?<?php echo time(); ?>" width="132" height="46" alt="Captcha image" /></a></div>
+ <label for="captcha">Enter the characters as seen on the image above (case insensitive):</label>
+ <input type="text" maxlength="6" name="captcha" id="captcha" />
+ <input type="submit" name="submit" id="submit" value="Check" />
+</fieldset>
+</form>
+
+<p>If you can&#39;t decipher the text on the image, click it to dynamically generate a new one.</p>
+
+</body>
+
+</html>
12 demo/captcha/newsession.php
@@ -0,0 +1,12 @@
+<?php
+
+// Include the random string file
+require 'rand.php';
+
+// Begin a new session
+session_start();
+
+// Set the session contents
+$_SESSION['captcha_id'] = $str;
+
+?>
14 demo/captcha/process.php
@@ -0,0 +1,14 @@
+<?php
+
+// Begin the session
+session_start();
+
+// To avoid case conflicts, make the input uppercase and check against the session value
+// If it's correct, echo '1' as a string
+if(strtoupper($_GET['captcha']) == $_SESSION['captcha_id'])
+ echo 'true';
+// Else echo '0' as a string
+else
+ echo 'false';
+
+?>
11 demo/captcha/rand.php
@@ -0,0 +1,11 @@
+<?php
+
+// Create a random string, leaving out 'o' to avoid confusion with '0'
+$char = strtoupper(substr(str_shuffle('abcdefghjkmnpqrstuvwxyz'), 0, 4));
+
+// Concatenate the random string onto the random numbers
+// The font 'Anorexia' doesn't have a character for '8', so the numbers will only go up to 7
+// '0' is left out to avoid confusion with 'O'
+$str = rand(1, 7) . rand(1, 7) . $char;
+
+?>
140 demo/captcha/style.css
@@ -0,0 +1,140 @@
+body {
+ margin: 3% 5%;
+ padding: 0;
+ background-color: #fff;
+ color: #333;
+ font: 0.9em/1.3 Helvetica, Arial, Verdana, Sans-serif;
+}
+
+a:link, a:visited {
+ background-color: #fff;
+ color: #333;
+ text-decoration: underline;
+}
+
+a:hover, a:focus, a:active {
+ background-color: #ffb;
+ color: #454545;
+ text-decoration: underline;
+}
+
+h1 {
+ margin: 2% 0%;
+ padding: 1%;
+ border-bottom: 1px solid #ddd;
+ background-color: #f8f8f8;
+ color: #666;
+ font: normal 1.5em Helvetica, Arial, Verdana, Sans-serif;
+}
+
+h2 {
+ margin: 2% 0%;
+ padding: 1%;
+ border-bottom: 1px solid #ddd;
+ background-color: #f8f8f8;
+ color: #666;
+ font: normal 1.3em Helvetica, Arial, Verdana, Sans-serif;
+}
+
+h3 {
+ margin: 2% 0%;
+ padding: 1%;
+ border-bottom: 1px solid #ddd;
+ background-color: #f8f8f8;
+ color: #666;
+ font: normal 1.2em Helvetica, Arial, Verdana, Sans-serif;
+}
+
+table {
+ margin: 0;
+ padding: 0;
+ width: 100%;
+}
+
+table th {
+ border: 1px solid #ddd;
+ font-weight: bold;
+ text-align: left;
+ padding: 1%;
+}
+
+table td {
+ border: 1px solid #ddd;
+ padding: 1%;
+}
+
+dl, dt, dd {
+ margin: 0;
+ padding: 0;
+}
+
+form {
+ margin: 0;
+ padding: 0;
+}
+
+fieldset {
+ border: 1px solid #ddd;
+ margin: 0% 0% 2% 0%;
+ padding: 2%;
+}
+
+fieldset legend {
+ margin: 0;
+ padding: 0 4px;
+ background-color: inherit;
+ color: #333;
+}
+
+code {
+ font: 1em "Courier New", Courier, Monospace;
+}
+
+pre code {
+ font: 1.1em "Courier New", Courier, Monospace;
+ border-bottom: 1px solid #eee;
+}
+
+img {
+ border: 1px solid #eee;
+}
+
+p#statusgreen {
+ font-size: 1.2em;
+ background-color: #fff;
+ color: #0a0;
+}
+
+p#statusred {
+ font-size: 1.2em;
+ background-color: #fff;
+ color: #a00;
+}
+
+fieldset label {
+ display: block;
+}
+
+fieldset label.error {
+ color: red;
+}
+
+fieldset label.valid {
+ color: green;
+}
+
+fieldset div#captchaimage {
+ float: left;
+ margin-right: 15px;
+}
+
+fieldset input#captcha {
+ width: 25%;
+ border: 1px solid #ddd;
+ padding: 2px;
+}
+
+fieldset input#submit {
+ display: block;
+ margin: 2% 0% 0% 0%;
+}
15 demo/css/chili.css
@@ -0,0 +1,15 @@
+.jscom, .mix htcom { color: #4040c2; }
+.com { color: green; }
+.regexp { color: maroon; }
+.string { color: teal; }
+.keywords { color: blue; }
+.global { color: #008; }
+.numbers { color: #880; }
+.comm { color: green; }
+.tag { color: blue; }
+.entity { color: blue; }
+.string { color: teal; }
+.aname { color: maroon; }
+.avalue { color: maroon; }
+.jquery { color: #00a; }
+.plugin { color: red; }
46 demo/css/cmxform.css
@@ -0,0 +1,46 @@
+/**********************************
+
+Name: cmxform Styles
+
+***********************************/
+form.cmxform {
+ width: 370px;
+ font-size: 1.0em;
+ color: #333;
+}
+
+form.cmxform legend {
+ padding-left: 0;
+}
+
+form.cmxform legend, form.cmxform label {
+ color: #333;
+}
+
+form.cmxform fieldset {
+ border: none;
+ border-top: 1px solid #C9DCA6;
+ background: url(../images/cmxform-fieldset.gif) left bottom repeat-x;
+ background-color: #F8FDEF;
+}
+
+form.cmxform fieldset fieldset {
+ background: none;
+}
+
+form.cmxform fieldset p, form.cmxform fieldset fieldset {
+ padding: 5px 10px 7px;
+ background: url(../images/cmxform-divider.gif) left bottom repeat-x;
+}
+
+form.cmxform label.error, label.error {
+ /* remove the next line when you have trouble in IE6 with labels in list */
+ color: red;
+ font-style: italic
+}
+div.error { display: none; }
+input { border: 1px solid black; }
+input.checkbox { border: none }
+input:focus { border: 1px dotted black; }
+input.error { border: 1px dotted red; }
+form.cmxform .gray * { color: gray; }
55 demo/css/cmxformTemplate.css
@@ -0,0 +1,55 @@
+/**********************************
+
+Use: cmxform template
+
+***********************************/
+form.cmxform fieldset {
+ margin-bottom: 10px;
+}
+
+form.cmxform legend {
+ padding: 0 2px;
+ font-weight: bold;
+ _margin: 0 -7px; /* IE Win */
+}
+
+form.cmxform label {
+ display: inline-block;
+ line-height: 1.8;
+ vertical-align: top;
+ cursor: hand;
+}
+
+form.cmxform fieldset p {
+ list-style: none;
+ padding: 5px;
+ margin: 0;
+}
+
+form.cmxform fieldset fieldset {
+ border: none;
+ margin: 3px 0 0;
+}
+
+form.cmxform fieldset fieldset legend {
+ padding: 0 0 5px;
+ font-weight: normal;
+}
+
+form.cmxform fieldset fieldset label {
+ display: block;
+ width: auto;
+}
+
+form.cmxform label { width: 100px; } /* Width of labels */
+form.cmxform fieldset fieldset label { margin-left: 103px; } /* Width plus 3 (html space) */
+form.cmxform label.error {
+ margin-left: 103px;
+ width: 220px;
+}
+
+form.cmxform input.submit {
+ margin-left: 103px;
+}
+
+/*\*//*/ form.cmxform legend { display: inline-block; } /* IE Mac legend fix */
21 demo/css/core.css
@@ -0,0 +1,21 @@
+body, div { font-family: 'lucida grande', helvetica, verdana, arial, sans-serif }
+body { margin: 0; padding: 0; font-size: small; color: #333 }
+h1, h2 { font-family: 'trebuchet ms', verdana, arial; padding: 10px; margin: 0 }
+h1 { font-size: large }
+#main { padding: 1em; }
+#banner { padding: 15px; background-color: #06b; color: white; font-size: large; border-bottom: 1px solid #ccc;
+ background: url(../images/bg.gif) repeat-x; text-align: center }
+#banner a { color: white; }
+
+p { margin: 10px 0; }
+
+li { margin-left: 10px; }
+
+h3 { margin: 1em 0 0; }
+
+h1 { font-size: 2em; }
+h2 { font-size: 1.8em; }
+h3 { font-size: 1.6em; }
+h4 { font-size: 1.4em; }
+h5 { font-size: 1.2em; }
+
61 demo/css/reset.css
@@ -0,0 +1,61 @@
+/**********************************
+
+Use: Reset Styles for all browsers
+
+***********************************/
+
+body, p, blockquote {
+ margin: 0;
+ padding: 0;
+}
+
+a img, iframe { border: none; }
+
+/* Headers
+------------------------------*/
+
+h1, h2, h3, h4, h5, h6 {
+ margin: 0;
+ padding: 0;
+ font-size: 100%;
+}
+
+/* Lists
+------------------------------*/
+
+ul, ol, dl, li, dt, dd {
+ margin: 0;
+ padding: 0;
+}
+
+/* Links
+------------------------------*/
+
+a, a:link {}
+a:visited {}
+a:hover {}
+a:active {}
+
+/* Forms
+------------------------------*/
+
+form, fieldset {
+ margin: 0;
+ padding: 0;
+}
+
+fieldset { border: 1px solid #000; }
+
+legend {
+ padding: 0;
+ color: #000;
+}
+
+input, textarea, select {
+ margin: 0;
+ padding: 1px;
+ font-size: 100%;
+ font-family: inherit;
+}
+
+select { padding: 0; }
11 demo/css/screen.css
@@ -0,0 +1,11 @@
+/**********************************
+
+Use: Main Screen Import
+
+***********************************/
+
+@import "reset.css";
+@import "core.css";
+
+@import "cmxformTemplate.css";
+@import "cmxform.css";
95 demo/custom-messages-metadata-demo.html
@@ -0,0 +1,95 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>jQuery validation plug-in - comment form example</title>
+
+<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
+
+<script src="../lib/jquery.js" type="text/javascript"></script>
+<script src="../jquery.validate.js" type="text/javascript"></script>
+<script src="../lib/jquery.metadata.js" type="text/javascript"></script>
+
+<!-- for styling the form -->
+<script src="js/cmxforms.js" type="text/javascript"></script>
+
+<script type="text/javascript">
+$(document).ready(function() {
+ $("#commentForm").validate({meta: "validate"});
+ $("#commentForm2").validate();
+ $("#commentForm3").validate({
+ messages: {
+ email: {
+ required: 'Enter this!'
+ }
+ }
+ });
+
+});
+</script>
+
+<style type="text/css">
+form { width: 500px; }
+form label { width: 250px; }
+form label.error,
+form input.submit { margin-left: 253px; }
+</style>
+
+</head>
+<body>
+
+<h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">jQuery Validation Plugin</a> Demo</h1>
+<div id="main">
+
+<p>Take a look at the source to see how messages can be customized with metadata.</p>
+
+<!-- Custom messages with custom "meta" setting -->
+<form class="cmxform" id="commentForm" method="post" action="">
+ <fieldset>
+ <legend>Please enter your email address</legend>
+ <p>
+
+ <label for="cemail">E-Mail *</label>
+ <input id="cemail" name="email" class="{validate:{required:true, email:true, messages:{required:'Please enter your email address', email:'Please enter a valid email address'}}}"/>
+ </p>
+ <p>
+ <input class="submit" type="submit" value="Submit"/>
+ </p>
+ </fieldset>
+</form>
+<!-- Custom messages with default "meta" setting -->
+<form class="cmxform" id="commentForm2" method="post" action="">
+ <fieldset>
+ <legend>Please enter your email address</legend>
+ <p>
+
+ <label for="cemail">E-Mail *</label>
+ <input id="cemail" name="email" class="{required:true, email:true, messages:{required:'Please enter your email address', email:'Please enter a valid email address'}}"/>
+ </p>
+ <p>
+ <input class="submit" type="submit" value="Submit"/>
+ </p>
+ </fieldset>
+</form>
+<!-- Custom message for "required" in metadata is overriden by a validate option -->
+<form class="cmxform" id="commentForm3" method="post" action="">
+ <fieldset>
+ <legend>Please enter your email address</legend>
+ <p>
+
+ <label for="cemail">E-Mail *</label>
+ <input id="cemail" name="email" class="{required:true, email:true, messages:{email:'Please enter a valid email address'}}"/>
+ </p>
+ <p>
+ <input class="submit" type="submit" value="Submit"/>
+ </p>
+ </fieldset>
+</form>
+
+<a href="index.html">Back to main page</a>
+
+<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
+<script type="text/javascript">_uacct = "UA-2623402-1";urchinTracker();</script>
+
+</body>
+</html>
123 demo/custom-methods-demo.html
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Test for jQuery validate() plugin</title>
+
+<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
+
+<script src="../lib/jquery.js" type="text/javascript"></script>
+<script src="../jquery.validate.js" type="text/javascript"></script>
+
+<script src="js/cmxforms.js" type="text/javascript"></script>
+<script type="text/javascript">
+ // extend the current rules with new groovy ones
+
+ // this one requires the text "buga", we define a default message, too
+ $.validator.addMethod("buga", function(value) {
+ return value == "buga";
+ }, 'Please enter "buga"!');
+
+ // this one requires the value to be the same as the first parameter
+ $.validator.methods.equal = function(value, element, param) {
+ return value == param;
+ };
+
+ $().ready(function() {
+ var validator = $("#texttests").bind("invalid-form.validate", function() {
+ $("#summary").html("Your form contains " + validator.numberOfInvalids() + " errors, see details below.");
+ }).validate({
+ debug: true,
+ errorElement: "em",
+ errorContainer: $("#warning, #summary"),
+ errorPlacement: function(error, element) {
+ error.appendTo( element.parent("td").next("td") );
+ },
+ success: function(label) {
+ label.text("ok!").addClass("success");
+ },
+ rules: {
+ number: {
+ required:true,
+ minLength:3,
+ maxLength:15,
+ number:true
+ },
+ secret: "buga",
+ math: {
+ equal: 11
+ }
+ }
+ });
+
+ });
+</script>
+
+<style type="text/css">
+form.cmxform { width: 50em; }
+em.error {
+ background:url("images/unchecked.gif") no-repeat 0px 0px;
+ padding-left: 16px;
+}
+em.success {
+ background:url("images/checked.gif") no-repeat 0px 0px;
+ padding-left: 16px;
+}
+
+form.cmxform label.error {
+ margin-left: auto;
+ width: 250px;
+}
+em.error { color: black; }
+#warning { display: none; }
+</style>
+
+</head>
+<body>
+
+<h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">jQuery Validation Plugin</a> Demo</h1>
+<div id="main">
+
+<form class="cmxform" id="texttests" method="get" action="foo.html">
+ <h2 id="summary"></h2>
+
+ <fieldset>
+ <legend>Example with custom methods and heavily customized error display</legend>
+ <table>
+ <tr>
+ <td><label for="number">textarea</label></td>
+ <td><input id="number" name="number"
+ title="Please enter a number with at least 3 and max 15 characters!" />
+ </td>
+ <td></td>
+ </tr>
+ <tr>
+ <td><label for="secret">Secret</label></td>
+ <td><input name="secret" id="secret" /></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td><label for="math">7 + 4 = </label></td>
+ <td><input id="math" name="math" title="Please enter the correct result!" /></td>
+ <td></td>
+ </tr>
+ </table>
+ <input class="submit" type="submit" value="Submit"/>
+ </fieldset>
+</form>
+
+<h3 id="warning">Your form contains tons of errors! Please try again.</h3>
+
+<p><a href="index.html">Back to main page</a></p>
+
+</div>
+
+<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
+</script>
+<script type="text/javascript">
+_uacct = "UA-2623402-1";
+urchinTracker();
+</script>
+</body>
+</html>
151 demo/dynamic-totals.html
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>jQuery validation plug-in - dynamic forms demo</title>
+
+<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
+
+<script src="../lib/jquery.js" type="text/javascript"></script>
+<script src="../jquery.validate.js" type="text/javascript"></script>
+
+<script type="text/javascript">
+// only for demo purposes
+$.validator.setDefaults({
+ submitHandler: function() {
+ alert("submitted!");
+ }
+});
+$.validator.messages.max = jQuery.format("Your totals musn't exceed {0}!");
+
+$.validator.addMethod("quantity", function(value, element) {
+ return !this.optional(element) && !this.optional($(element).parent().prev().children("select")[0]);
+}, "Please select both the item and its amount.");
+
+$().ready(function() {
+ $("#orderform").validate({
+ errorPlacement: function(error, element) {
+ error.appendTo( element.parent().next() );
+ },
+ highlight: function(element, errorClass) {
+ $(element).addClass(errorClass).parent().prev().children("select").addClass(errorClass);
+ }
+ });
+
+ var template = jQuery.format($("#template").val());
+ function addRow() {
+ $(template(i++)).appendTo("#orderitems tbody");
+ }
+
+ var i = 1;
+ // start with one row
+ addRow();
+ // add more rows on click
+ $("#add").click(addRow);
+
+ // check keyup on quantity inputs to update totals field
+ $("#orderform").delegate("keyup", "input.quantity", function(event) {
+ var totals = 0;
+ $("#orderitems input.quantity").each(function() {
+ totals += +this.value;
+ });
+ $("#totals").attr("value", totals).valid();
+ });
+
+});
+</script>
+
+<style type="text/css">
+form.cmxform { width: 50em; }
+em.error {
+ background:url("images/unchecked.gif") no-repeat 0px 0px;
+ padding-left: 16px;
+}
+em.success {
+ background:url("images/checked.gif") no-repeat 0px 0px;
+ padding-left: 16px;
+}
+
+form.cmxform label.error {
+ margin-left: auto;
+ width: 250px;
+}
+form.cmxform input.submit {
+ margin-left: 0;
+}
+em.error { color: black; }
+#warning { display: none; }
+select.error {
+ border: 1px dotted red;
+}
+</style>
+
+</head>
+<body>
+
+<h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">jQuery Validation Plugin</a> Demo</h1>
+<div id="main">
+
+<textarea style="display:none" id="template">
+ <tr>
+ <td>
+ <label>{0}. Item</label>
+ </td>
+ <td class='type'>
+ <select name="item-type-{0}">
+ <option value="">Select...</option>
+ <option value="0">Learning jQuery</option>
+ <option value="1">jQuery Reference Guide</option>
+ <option value="2">jQuery Cookbook</option>
+ <option vlaue="3">jQuery In Action</option>
+ <option value="4">jQuery For Designers</option>
+ </select>
+ </td>
+ <td class='quantity'>
+ <input size='4' class="quantity" min="1" id="item-quantity-{0}" name="item-quantity-{0}" />
+ </td>
+ <td class='quantity-error'></td>
+ </tr>
+</textarea>
+
+<form id="orderform" class="cmxform" method="get" action="foo.html">
+ <h2 id="summary"></h2>
+
+ <fieldset>
+ <legend>Example with custom methods and heavily customized error display</legend>
+ <table id="orderitems">
+ <tbody>
+
+ </tbody>
+ <tfoot>
+ <tr>
+ <td colspan="2"><label>Totals (max 25)</label></td>
+ <td class="totals"><input id="totals" name="totals" value="0" max="25" readonly="readonly" size='4' /></td>
+ <td class="totals-error"></td>
+ </tr>
+ <tr>
+ <td colspan="2">&nbsp;</td>
+ <td><input class="submit" type="submit" value="Submit"/></td>
+ </tr>
+ </tfoot>
+ </table>
+ </fieldset>
+</form>
+
+<button id="add">Add another input to the form</button>
+
+<h1 id="warning">Your form contains tons of errors! Please try again.</h1>
+
+<p><a href="index.html">Back to main page</a></p>
+
+</div>
+
+<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
+</script>
+<script type="text/javascript">
+_uacct = "UA-2623402-1";
+urchinTracker();
+</script>
+</body>
+</html>
162 demo/errorcontainer-demo.html
@@ -0,0 +1,162 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Test for jQuery validate() plugin</title>
+
+<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
+
+<script src="../lib/jquery.js" type="text/javascript"></script>
+<script src="../lib/jquery.metadata.js" type="text/javascript"></script>
+<script src="../jquery.validate.js" type="text/javascript"></script>
+
+<script src="js/cmxforms.js" type="text/javascript"></script>
+<style type="text/css">
+.cmxform fieldset p.error label { color: red; }
+div.container {
+ background-color: #eee;
+ border: 1px solid red;
+ margin: 5px;
+ padding: 5px;
+}
+div.container ol li {
+ list-style-type: disc;
+ margin-left: 20px;
+}
+div.container { display: none }
+.container label.error {
+ display: inline;
+}
+form.cmxform { width: 30em; }
+form.cmxform label.error {
+ display: block;
+ margin-left: 1em;
+ width: auto;
+}
+</style>
+
+<script type="text/javascript">
+// only for demo purposes
+$.validator.setDefaults({
+ submitHandler: function() {
+ alert("submitted! (skipping validation for cancel button)");
+ }
+});
+
+$().ready(function() {
+ $("#form1").validate({
+ errorLabelContainer: $("#form1 div.error")
+ });
+
+ var container = $('div.container');
+ // validate the form when it is submitted
+ var validator = $("#form2").validate({
+ errorContainer: container,
+ errorLabelContainer: $("ol", container),
+ wrapper: 'li',
+ meta: "validate"
+ });
+
+ $(".cancel").click(function() {
+ validator.resetForm();
+ });
+});
+</script>
+
+</head>
+<body>
+
+<h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">jQuery Validation Plugin</a> Demo</h1>
+<div id="main">
+
+<form method="get" class="cmxform" id="form1" action="">
+ <fieldset>
+ <legend>Login Form</legend>
+ <p>
+ <label>Username</label>
+ <input name="user" title="Please enter your username (at least 3 characters)" class="{required:true,minlength:3}" />
+ </p>
+ <p>
+ <label>Password</label>
+ <input type="password" maxlength="12" name="password" title="Please enter your password, between 5 and 12 characters" class="{required:true,minlength:5}" />
+ </p>
+ <div class="error">
+ </div>
+ <p>
+ <input class="submit" type="submit" value="Login"/>
+ </p>
+ </fieldset>
+</form>
+
+<!-- our error container -->
+<div class="container">
+ <h4>There are serious errors in your form submission, please see below for details.</h4>
+ <ol>
+ <li><label for="email" class="error">Please enter your email address</label></li>
+ <li><label for="phone" class="error">Please enter your phone <b>number</b> (between 2 and 8 characters)</label></li>
+ <li><label for="address" class="error">Please enter your address (at least 3 characters)</label></li>
+ <li><label for="avatar" class="error">Please select an image (png, jpg, jpeg, gif)</label></li>
+ <li><label for="cv" class="error">Please select a document (doc, docx, txt, pdf)</label></li>
+ </ol>
+</div>
+
+<form class="cmxform" id="form2" method="get" action="">
+ <fieldset>
+ <legend>Validating a complete form</legend>
+ <p>
+ <label for="email">Email</label>
+ <input id="email" name="email" class="{validate:{required:true,email:true}}" />
+ </p>
+ <p>
+ <label for="agree">Favorite Color</label>
+ <select id="color" name="color" title="Please select your favorite color!" class="{validate:{required:true}}">
+ <option></option>
+ <option>Red</option>
+ <option>Blue</option>
+ <option>Yellow</option>
+ </select>
+ </p>
+ <p>
+ <label for="phone">Phone</label>
+ <input id="phone" name="phone" class="some styles {validate:{required:true,number:true, rangelength:[2,8]}}" />
+ </p>
+ <p>
+ <label for="address">Address</label>
+ <input id="address" name="address" class="some other styles {validate:{required:true,minlength:3}}" />
+ </p>
+ <p>
+ <label for="avatar">Avatar</label>
+ <input type="file" id="avatar" name="avatar" class="{validate:{required:true,accept:true}}" />
+ </p>
+ <p>
+ <label for="agree">Please agree to our policy</label>
+ <input type="checkbox" class="checkbox" id="agree" title="Please agree to our policy!" name="agree" class="{validate:{required:true}}" />
+ </p>
+ <p>
+ <label for="cv">CV</label>
+ <input type="file" id="cv" name="cv" class="{validate:{required:true,accept:'docx?|txt|pdf'}}" />
+ </p>
+ <p>
+ <input class="submit" type="submit" value="Submit"/>
+ <input class="cancel" type="submit" value="Cancel"/>
+ </p>
+ </fieldset>
+</form>
+
+<div class="container">
+ <h4>There are serious errors in your form submission, please see details above the form!</h4>
+</div>
+
+<a href="index.html">Back to main page</a>
+
+</div>
+
+<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
+</script>
+<script type="text/javascript">
+_uacct = "UA-2623402-1";
+urchinTracker();
+</script>
+</body>
+</html>
55 demo/example.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>jQuery validation plug-in - comment form example</title>
+
+<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
+
+<script src="../lib/jquery.js" type="text/javascript"></script>
+<script src="../jquery.validate.js" type="text/javascript"></script>
+
+<!-- for styling the form -->
+<script src="js/cmxforms.js" type="text/javascript"></script>
+
+<script type="text/javascript">
+$(document).ready(function() {
+ $("#commentForm").validate();
+});
+</script>
+
+<style type="text/css">
+#commentForm { width: 500px; }
+#commentForm label { width: 250px; }
+#commentForm label.error, #commentForm input.submit { margin-left: 253px; }
+</style>
+
+</head>
+<body>
+
+<form class="cmxform" id="commentForm" method="post" action="">
+ <fieldset>
+ <legend>Please provide your name, email address (won't be published) and a comment</legend>
+ <p>
+ <label for="cname">Name (required, at least 2 characters)</label>
+ <input id="cname" name="name" class="required" minlength="2" />
+ <p>
+ <label for="cemail">E-Mail (required)</label>
+ <input id="cemail" name="email" class="required email" />
+ </p>
+ <p>
+ <label for="curl">URL (optional)</label>
+ <input id="curl" name="url" class="url" value="" />
+ </p>
+ <p>
+ <label for="ccomment">Your comment (required)</label>
+ <textarea id="ccomment" name="comment" class="required"></textarea>
+ </p>
+ <p>
+ <input class="submit" type="submit" value="Submit"/>
+ </p>
+ </fieldset>
+</form>
+
+</body>
+</html>
10 demo/form.php
@@ -0,0 +1,10 @@
+<?php
+// wait a second to simulate a some latency
+usleep(500000);
+$user = $_REQUEST['user'];
+$pw = $_REQUEST['password'];
+if($user && $pw && $pw == "foobar")
+ echo "Hi $user, welcome back.";
+else
+ echo "Your password is wrong (must be foobar).";
+?>
10 demo/form.phps
@@ -0,0 +1,10 @@
+<?php
+// wait a second to simulate a some latency
+usleep(500000);
+$user = $_REQUEST['user'];
+$pw = $_REQUEST['password'];
+if($user && $pw && $pw == "foobar")
+ echo "Hi $user, welcome back.";
+else
+ echo "Your password is wrong (must be foobar).";
+?>
BIN  demo/images/bg.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  demo/images/checked.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  demo/images/cmxform-divider.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  demo/images/cmxform-fieldset.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  demo/images/loading.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN  demo/images/unchecked.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
235 demo/index.html
@@ -0,0 +1,235 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>jQuery validation plug-in - main demo</title>
+
+<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
+
+<script src="../lib/jquery.js" type="text/javascript"></script>
+<script src="../jquery.validate.js" type="text/javascript"></script>
+
+<script src="js/cmxforms.js" type="text/javascript"></script>
+<script type="text/javascript">
+$.validator.setDefaults({
+ submitHandler: function() { alert("submitted!"); }
+});
+
+$().ready(function() {
+ // validate the comment form when it is submitted
+ $("#commentForm").validate();
+
+ // validate signup form on keyup and submit
+ $("#signupForm").validate({
+ rules: {
+ firstname: "required",
+ lastname: "required",
+ username: {
+ required: true,
+ minlength: 2
+ },
+ password: {
+ required: true,
+ minlength: 5
+ },
+ confirm_password: {
+ required: true,
+ minlength: 5,
+ equalTo: "#password"
+ },
+ email: {
+ required: true,
+ email: true
+ },
+ topic: {
+ required: "#newsletter:checked",
+ minlength: 2
+ },
+ agree: "required"
+ },
+ messages: {
+ firstname: "Please enter your firstname",
+ lastname: "Please enter your lastname",
+ username: {
+ required: "Please enter a username",
+ minlength: "Your username must consist of at least 2 characters"
+ },
+ password: {
+ required: "Please provide a password",
+ minlength: "Your password must be at least 5 characters long"
+ },
+ confirm_password: {
+ required: "Please provide a password",
+ minlength: "Your password must be at least 5 characters long",
+ equalTo: "Please enter the same password as above"
+ },
+ email: "Please enter a valid email address",
+ agree: "Please accept our policy"
+ }
+ });
+
+ // propose username by combining first- and lastname
+ $("#username").focus(function() {
+ var firstname = $("#firstname").val();
+ var lastname = $("#lastname").val();
+ if(firstname && lastname && !this.value) {
+ this.value = firstname + "." + lastname;
+ }
+ });
+
+ // check if confirm password is still valid after password changed
+ $("#password").blur(function() {
+ $("#confirm_password").valid();
+ });
+
+ //code to hide topic selection, disable for demo
+ var newsletter = $("#newsletter");
+ // newsletter topics are optional, hide at first
+ var inital = newsletter.is(":checked");
+ var topics = $("#newsletter_topics")[inital ? "removeClass" : "addClass"]("gray");
+ var topicInputs = topics.find("input").attr("disabled", !inital);
+ // show when newsletter is checked
+ newsletter.click(function() {
+ topics[this.checked ? "removeClass" : "addClass"]("gray");
+ topicInputs.attr("disabled", !this.checked);
+ });
+});
+</script>
+
+<style type="text/css">
+#commentForm { width: 500px; }
+#commentForm label { width: 250px; }
+#commentForm label.error, #commentForm input.submit { margin-left: 253px; }
+#signupForm { width: 670px; }
+#signupForm label.error {
+ margin-left: 10px;
+ width: auto;
+ display: inline;
+}
+#newsletter_topics label.error {
+ display: none;
+ margin-left: 103px;
+}
+</style>
+
+</head>
+<body>
+
+<h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">jQuery Validation Plugin</a> Demo</h1>
+<div id="main">
+
+<p>Default submitHandler is set to display an alert into of submitting the form</p>
+
+<form class="cmxform" id="commentForm" method="get" action="">
+ <fieldset>
+ <legend>Please provide your name, email address (won't be published) and a comment</legend>
+ <p>
+ <label for="cname">Name (required, at least 2 characters)</label>
+ <input id="cname" name="name" class="required" minlength="2" />
+ <p>
+ <label for="cemail">E-Mail (required)</label>
+ <input id="cemail" name="email" class="required email" />
+ </p>
+ <p>
+ <label for="curl">URL (optional)</label>
+ <input id="curl" name="url" class="url" value="" />
+ </p>
+ <p>
+ <label for="ccomment">Your comment (required)</label>
+ <textarea id="ccomment" name="comment" class="required"></textarea>
+ </p>
+ <p>
+ <input class="submit" type="submit" value="Submit"/>
+ </p>
+ </fieldset>
+</form>
+
+<form class="cmxform" id="signupForm" method="get" action="">
+ <fieldset>
+ <legend>Validating a complete form</legend>
+ <p>
+ <label for="firstname">Firstname</label>
+ <input id="firstname" name="firstname" />
+ </p>
+ <p>
+ <label for="lastname">Lastname</label>
+ <input id="lastname" name="lastname" />
+ </p>
+ <p>
+ <label for="username">Username</label>
+ <input id="username" name="username" />
+ </p>
+ <p>
+ <label for="password">Password</label>
+ <input id="password" name="password" type="password" />
+ </p>
+ <p>
+ <label for="confirm_password">Confirm password</label>
+ <input id="confirm_password" name="confirm_password" type="password" />
+ </p>
+ <p>
+ <label for="email">Email</label>
+ <input id="email" name="email" />
+ </p>
+ <p>
+ <label for="agree">Please agree to our policy</label>
+ <input type="checkbox" class="checkbox" id="agree" name="agree" />
+ </p>
+ <p>
+ <label for="newsletter">I'd like to receive the newsletter</label>
+ <input type="checkbox" class="checkbox" id="newsletter" name="newsletter" />
+ </p>
+ <fieldset id="newsletter_topics">
+ <legend>Topics (select at least two) - note: would be hidden when newsletter isn't selected, but is visible here for the demo</legend>
+ <label for="topic_marketflash">
+ <input type="checkbox" id="topic_marketflash" value="marketflash" name="topic" />
+ Marketflash
+ </label>
+ <label for="topic_fuzz">
+ <input type="checkbox" id="topic_fuzz" value="fuzz" name="topic" />
+ Latest fuzz
+ </label>
+ <label for="topic_digester">