Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready(function() {
  2.     $('#submit_form').validate({
  3.         rules: {
  4.             first_name: {
  5.                 required: true,
  6.                 minlength: 3,
  7.                 maxlength: 30
  8.             },
  9.             last_name: {
  10.                 required: true,
  11.                 minlength: 2,
  12.                 maxlength: 40
  13.             },
  14.             address: {
  15.                 required: true
  16.             },
  17.             education: {
  18.                 required: true
  19.             },
  20.             age: {
  21.                 required: true,
  22.                 max: 115
  23.             },
  24.             email: {
  25.                 required: true,
  26.                 email: true
  27.             }
  28.         },
  29.         messages: {
  30.             first_name: {
  31.                 required: "Wpisz swoje imię.",
  32.                 minlength: "Tak krótkie imię? Nie wierzę. Wprowadź co najmniej 3 litery.",
  33.                 maxlength: "Twoje imię nie może być tak długie. Wprowadź maksymalnie 30 liter."
  34.             },
  35.             last_name: {
  36.                 required: "Wpisz swoje nazwisko",
  37.                 minlength: "Tak krótkie nazwisko? Nie wierzę. Wprowadź co najmniej 2 litery.",
  38.                 maxlength: "Twoje nazwisko nie może być tak długie. Wprowadź maksymalnie 40 liter."
  39.             },
  40.             address: {
  41.                 required: "Podaj swój adres."
  42.             },
  43.             education: {
  44.                 required: "Wybierz pole z Twoim wykształceniem."
  45.             },
  46.             age: {
  47.                 required: "Przyznaj się, ile wiosen masz za sobą?",
  48.                 max: "Nie możesz być tak stary!"
  49.             },
  50.             email: {
  51.                 required: "Podaj swój adres emai.",
  52.                 email: "Wprowadź prawidłowy adres email."
  53.             },
  54.         },
  55.         submitHandler: function(form) {
  56.           if (!confirm("Czy na pewno chcesz wysłac formularz?"))
  57.             evt.preventDefault();
  58.           }
  59.     });
  60. });
  61.  
  62.  
  63. $('#clear').click(function(evt) {
  64.     if (!confirm("Czy na pewno chcesz wyczyścic formularz?")) {
  65.       evt.preventDefault();
  66.     }
  67. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement