Jquery form submit validation

0 votes

I have following form:

<form id="testForm" action="country_Save">
   Country Name:<input type="text" id="countryName" />  
   <input type="submit" id='saveCountry' value="Add Country" />
</form>

and following JQuery for validating textfield

$('#testForm')
   .jqxValidator({  rules : [
          {
              input : '#countryName',
              message : 'Country Name is required!',
              action : 'keyup, blur',
              rule : 'required'
          }],
          theme : theme
});

How can i use this validation when I am submitting a form?

Jun 20 in JQuery by gaurav
• 17,580 points
34 views

1 answer to this question.

0 votes

Bind a function to the submit event of the form. Return false in this function if any of the form fields fail validation.

For example:

$('form').on('submit', function() {
    // do validation here
    if(/* not valid */)
        return false;
});
answered Jun 20 by rajatha
• 7,040 points

Related Questions In JQuery

0 votes
1 answer

A simple jQuery form validation script

use jQuery validation plugin to validate forms' ...READ MORE

answered Jun 1 in JQuery by Edureka
• 13,640 points
26 views
0 votes
1 answer

Submit a form using jQuery

This method is a shortcut for .on( ...READ MORE

answered Jun 6 in JQuery by Edureka
• 13,640 points
21 views
0 votes
1 answer

How to convert form data to JavaScript object with jQuery?

Hello @kartik, You can use: function form_to_json (selector) { ...READ MORE

answered Apr 28, 2020 in JQuery by Niroj
• 82,740 points
1,580 views
0 votes
1 answer

How to make a simple modal pop up form using jquery and html?

Create A Modal <button onclick="document.getElementById('id01').style.display='block'" class="w3-button">Open Modal</button> ... <div ...READ MORE

answered Jun 2 in JQuery by Edureka
• 13,640 points
132 views
0 votes
0 answers

Email validation using jQuery

How can I use JQuery to validate ...READ MORE

May 21 in JQuery by Kichu
• 19,040 points
36 views
0 votes
1 answer

Email validation using jQuery

You can use regular old javascript for ...READ MORE

answered Jun 3 in JQuery by Edureka
• 13,640 points
27 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Jquery validation plugin - TypeError: $(...).validate is not a function

The "$(...). validate is not a function" ...READ MORE

answered Jun 28 in JQuery by rajatha
• 7,040 points
690 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP