jquery.validationEngine-es.js 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. 
  2. (function($){
  3. $.fn.validationEngineLanguage = function(){
  4. };
  5. $.validationEngineLanguage = {
  6. newLang: function(){
  7. $.validationEngineLanguage.allRules = {
  8. "required": { // Add your regex rules here, you can take telephone as an example
  9. "regex": "none",
  10. "alertText": "* Este campo es obligatorio",
  11. "alertTextCheckboxMultiple": "* Por favor seleccione una opción",
  12. "alertTextCheckboxe": "* Este checkbox es obligatorio"
  13. },
  14. "requiredInFunction": {
  15. "func": function(field, rules, i, options){
  16. return (field.val() == "test") ? true : false;
  17. },
  18. "alertText": "* Field must equal test"
  19. },
  20. "minSize": {
  21. "regex": "none",
  22. "alertText": "* Mínimo de ",
  23. "alertText2": " caracteres autorizados"
  24. },
  25. "groupRequired": {
  26. "regex": "none",
  27. "alertText": "* Debe de rellenar al menos uno de los siguientes campos"
  28. },
  29. "maxSize": {
  30. "regex": "none",
  31. "alertText": "* Máximo de ",
  32. "alertText2": " caracteres autorizados"
  33. },
  34. "min": {
  35. "regex": "none",
  36. "alertText": "* El valor mínimo es "
  37. },
  38. "max": {
  39. "regex": "none",
  40. "alertText": "* El valor máximo es "
  41. },
  42. "past": {
  43. "regex": "none",
  44. "alertText": "* Fecha anterior a "
  45. },
  46. "future": {
  47. "regex": "none",
  48. "alertText": "* Fecha posterior a "
  49. },
  50. "maxCheckbox": {
  51. "regex": "none",
  52. "alertText": "* Se ha excedido el número de opciones permitidas"
  53. },
  54. "minCheckbox": {
  55. "regex": "none",
  56. "alertText": "* Por favor seleccione ",
  57. "alertText2": " opciones"
  58. },
  59. "equals": {
  60. "regex": "none",
  61. "alertText": "* Los campos no coinciden"
  62. },
  63. "creditCard": {
  64. "regex": "none",
  65. "alertText": "* La tarjeta de crédito no es válida"
  66. },
  67. "phone": {
  68. // credit: jquery.h5validate.js / orefalo
  69. "regex": /^([\+][0-9]{1,3}[ \.\-])?([\(]{1}[0-9]{2,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,
  70. "alertText": "* Número de teléfono inválido"
  71. },
  72. "email": {
  73. // Shamelessly lifted from Scott Gonzalez via the Bassistance Validation plugin http://projects.scottsplayground.com/email_address_validation/
  74. "regex": /^((([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,
  75. "alertText": "* Correo inválido"
  76. },
  77. "integer": {
  78. "regex": /^[\-\+]?\d+$/,
  79. "alertText": "* No es un valor entero válido"
  80. },
  81. "number": {
  82. // Number, including positive, negative, and floating decimal. credit: orefalo
  83. "regex": /^[\-\+]?((([0-9]{1,3})([,][0-9]{3})*)|([0-9]+))?([\.]([0-9]+))?$/,
  84. "alertText": "* No es un valor decimal válido"
  85. },
  86. "date": {
  87. "regex": /^(0?[1-9]|[12][0-9]|3[01])[\/\-](0?[1-9]|1[012])[\/\-]\d{4}$/,
  88. "alertText": "* Fecha inválida, por favor utilize el formato DD/MM/AAAA"
  89. },
  90. "ipv4": {
  91. "regex": /^((([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))[.]){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))$/,
  92. "alertText": "* Direccion IP inválida"
  93. },
  94. "url": {
  95. "regex": /^(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,
  96. "alertText": "* URL Inválida"
  97. },
  98. "onlyNumberSp": {
  99. "regex": /^[0-9\ ]+$/,
  100. "alertText": "* Sólo números"
  101. },
  102. "onlyLetterSp": {
  103. "regex": /^[a-zA-Z\ \']+$/,
  104. "alertText": "* Sólo letras"
  105. },
  106. "onlyLetterNumber": {
  107. "regex": /^[0-9a-zA-Z]+$/,
  108. "alertText": "* No se permiten caracteres especiales"
  109. },
  110. // --- CUSTOM RULES -- Those are specific to the demos, they can be removed or changed to your likings
  111. "ajaxUserCall": {
  112. "url": "ajaxValidateFieldUser",
  113. // you may want to pass extra data on the ajax call
  114. "extraData": "name=eric",
  115. "alertTextLoad": "* Cargando, espere por favor",
  116. "alertText": "* Este nombre de usuario ya se encuentra usado"
  117. },
  118. "ajaxNameCall": {
  119. // remote json service location
  120. "url": "ajaxValidateFieldName",
  121. // error
  122. "alertText": "* Este nombre ya se encuentra usado",
  123. // if you provide an "alertTextOk", it will show as a green prompt when the field validates
  124. "alertTextOk": "* Este nombre está disponible",
  125. // speaks by itself
  126. "alertTextLoad": "* Cargando, espere por favor"
  127. },
  128. "validate2fields": {
  129. "alertText": "* Por favor entrar HELLO"
  130. }
  131. };
  132. }
  133. };
  134. $.validationEngineLanguage.newLang();
  135. })(jQuery);