Advertisement
moabcavsaenjoy

Untitled

Oct 1st, 2019
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. jQuery.validator.addMethod("codiceFiscale",function(value) {
  2. var regex = /[A-Z]{6}[\d]{2}[A-Z][\d]{2}[A-Z][\d]{3}[A-Z]/;
  3. return (value.match(regex))
  4. },"codice fiscale sbagliato");
  5.  
  6.  
  7. $().ready(function(){
  8.  
  9.  
  10. $("#form").validate({
  11. rules:{
  12. nome: {
  13. required: true
  14. },
  15. codiceFiscale: {
  16. required: true
  17. },
  18. telefono: {
  19. required:true
  20. },
  21. email: {
  22. required: true
  23. },
  24. password: {
  25. required:true
  26. },
  27. confermapassword: {
  28. required: true,
  29. equalTo: "#password"
  30. }
  31. },
  32. messages:{
  33. nome: {
  34. required: "nome"
  35. },
  36. telefono: "telefono non valido!",
  37. codicefiscale: {
  38. required: "codice fiscale"
  39. },
  40. email: "formato email non valido!",
  41. password: {
  42. required: "Inserisci una password!",
  43. minlength: "La password deve essere lunga minimo 4 caratteri",
  44. maxlength: "La password deve essere lunga al massimo 8 caratteri"
  45. },
  46. confermapassword: "la password non corrisponde!"
  47. },
  48. submitHandler: function(form){
  49. form.submit();
  50. },
  51. });
  52. });
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64. <!DOCTYPE html>
  65. <html lang="en">
  66. <head>
  67.  
  68. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  69. <link rel="stylesheet" href="css/bootstrap.min.css">
  70.  
  71.  
  72. <title>Document</title>
  73. </head>
  74. <body style="background-color:#efefef">
  75.  
  76. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  77. <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.1/jquery.validate.js"></script>
  78. <script src="js/bootstrap.min.js"></script>
  79. <script src="jqueryscript.js"></script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement