showing results for - "jquery validation and submit example"
Marta
27 Aug 2020
1$("#myform").validate({
2  submitHandler: function(form) {
3    $(form).ajaxSubmit();
4  }
5});
6
Erica
21 May 2017
1<form id="basic-form" action="" method="post">
2    <p>
3      <label for="name">Name <span>(required, at least 3 characters)</span></label>
4      <input id="name" name="name">
5    </p>
6  <p>
7      <label for="age">Your Age <span>(minimum 18)</span></label>
8      <input id="age" name="age">
9    </p>
10    <p>
11      <label for="email">E-Mail <span>(required)</span></label>
12      <input id="email" name="email">
13    </p>
14  <p>
15    <label for="weight">Weight <span>(required if age over 50)</span></label>
16    <input id="weight" name="weight">
17    </p>
18    <p>
19      <input class="submit" type="submit" value="SUBMIT">
20    </p>
21</form>
22
23$(document).ready(function() {
24  $("#basic-form").validate({
25    errorClass: "error fail-alert",
26    validClass: "valid success-alert",
27    rules: {
28      name : {
29        required: true,
30        minlength: 3
31      },
32      age: {
33        required: true,
34        number: true,
35        min: 18
36      },
37      email: {
38        required: true,
39        email: true
40      },
41      weight: {
42        required: {
43          depends: function(elem) {
44            return $("#age").val() > 50
45          }
46        },
47        number: true,
48        min: 0
49      }
50    },
51    messages : {
52      name: {
53        minlength: "Name should be at least 3 characters"
54      },
55      age: {
56        required: "Please enter your age",
57        number: "Please enter your age as a numerical value",
58        min: "You must be at least 18 years old"
59      },
60      email: {
61        email: "The email should be in the format: abc@domain.tld"
62      },
63      weight: {
64        required: "People with age over 50 have to enter their weight",
65        number: "Please enter your weight as a numerical value"
66      }
67    }
68  });
69});
queries leading to this page
submithandler jquery validateon submit valid jqureyjquery form validation and submitform validate jquery before submitjquery validate submiton submit validation jqueryjquery validation submithandlervalidate and submit form using jqueryvalidate on form submit jqueryjquery validation submit handler examplejquery validate form before submitvalidate form jquery before submitform submit after validation jqueryjquery trigger html form validationjquery form submit validationjquery submit html validaitonjquery validaiajax form submitjquery validate form submit form submit validation in jqueryrecheck jquery form validation on submitjquery html form validation before submitjquery form validation before submitjquery validation on submitjquery submit form validationjquery validate and submit form with apijquery form validation submit handler validate in jquery on submitjquery validation js submit hanflerhow to use jquery validation with out submit formjquery validation form submitjquery validation submit handleron submit jquery validation formjquery validation on submit buttonon submit jquery validationform validation using jquery when submit button clicksubmit form using jquery after validationsubmithandler jquery validationjquery validate and submit formform submit jquery validationjquery form validation on submitjquery on submit validationjquery validation and submit exampleform submit in jquery validation pluginevalidate submit form jqueryjquery validate submithandlerform is submitting jquery validatejquery submithandler validatejquery validate submit after validationjquery validate not submitting formsubmit handler in jquery validationsubmithandler jquery validation errorform submit with validation jquerysubmithandler jquery validatorjquery validate submit formjquery on submit and validjquery validator submiting form issuejquery form validation submithandlerjquery validate on form submitjquery form submit before validationjquery validate submit form on button clickvalidation on form submit in jqueryadd validation on form submit in jqueryjquery validation and submit example