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
• 13,460 points
8 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
• 4,940 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
14 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
9 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,720 points
1,450 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
29 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
22 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
9 views
0 votes
1 answer
0 votes
1 answer

How to use jquery with asp.net ajax?

If you weren't aware, Microsoft is planning ...READ MORE

answered Oct 15, 2018 in IoT (Internet of Things) by Annie97
• 2,160 points
174 views
0 votes
1 answer

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

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

answered 2 days ago in JQuery by rajatha
• 4,940 points
38 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