Permalink
Browse files

No commit message

  • Loading branch information...
0 parents commit ce7c5baa4e513d5fe168c315c47cab25a1ea4f80 @jzaefferer jzaefferer committed Aug 1, 2009
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
@@ -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.");
Oops, something went wrong.

0 comments on commit ce7c5ba

Please sign in to comment.