Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2017
65
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.                 min: 0, //ustaw
  23.                 max: 115,
  24.                 number: true //ustaw
  25.             },
  26.             email: {
  27.                 required: true,
  28.                 email: true
  29.             }
  30.         },
  31.         messages: {
  32.             first_name: {
  33.                 required: "Wpisz swoje imię.",
  34.                 minlength: "Tak krótkie imię? Nie wierzę. Wprowadź co najmniej 3 litery.",
  35.                 maxlength: "Twoje imię nie może być tak długie. Wprowadź maksymalnie 30 liter."
  36.             },
  37.             last_name: {
  38.                 required: "Wpisz swoje nazwisko",
  39.                 minlength: "Tak krótkie nazwisko? Nie wierzę. Wprowadź co najmniej 2 litery.",
  40.                 maxlength: "Twoje nazwisko nie może być tak długie. Wprowadź maksymalnie 40 liter."
  41.             },
  42.             address: {
  43.                 required: "Podaj swój adres."
  44.             },
  45.             education: {
  46.                 required: "Wybierz pole z Twoim wykształceniem."
  47.             },
  48.             age: {
  49.                 required: "Przyznaj się, ile wiosen masz za sobą?",
  50.                 max: "Nie możesz być tak stary!",
  51.                 number: "Coś się zepsuło, kasztanie!" //ustaw
  52.             },
  53.             email: {
  54.                 required: "Podaj swój adres emai.",
  55.                 email: "Wprowadź prawidłowy adres email."
  56.             },
  57.         },
  58.         submitHandler: function(form) {
  59.           if (!confirm("Czy na pewno chcesz wysłac formularz?"))
  60.             evt.preventDefault();
  61.           }
  62.     });
  63. });
  64.  
  65.  
  66. $('#clear').click(function(evt) {
  67.     if (!confirm("Czy na pewno chcesz wyczyścic formularz?")) {
  68.       evt.preventDefault();
  69.     }
  70. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement