?
Solved

jQuery Question

Posted on 2010-01-13
1
Medium Priority
?
260 Views
Last Modified: 2012-05-08
Hello,

I'm using jquery with the form and validation plugins. I have this:

<script type="text/javascript">
        $(document).ready(function() {
                $("#autoSumForm").validate({
                        rules: {
                                p1001: {number: true},
                                p1002: {number: true}
                        },
                        messages: {
                                p1001: "",
                                p1002: ""
                        }
                });

                $('#autoSumForm').ajaxForm(function() {
                        alert("Time submitted.");
                });
        });
</script>

The validation and the form submit both work, but the form submits
even if not valid. How do I combine the two?

Thanks.
0
Comment
Question by:swilschutz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 10

Accepted Solution

by:
Terry_focus earned 2000 total points
ID: 26303250
Here you can use ajaxSubmit instead of ajaxForm
<script type="text/javascript">
        $(document).ready(function() {
                $("#autoSumForm").validate({
                        rules: {
                                p1001: {number: true},
                                p1002: {number: true}
                        },
                        messages: {
                                p1001: "",
                                p1002: ""
                        },
                        submitHandler: function(form) {
   	                    $(form).ajaxSubmit(function(){alert("Time submitted.");});
                        }
                });

        });
</script>

Open in new window

0

Featured Post

DFW AZURE MEETUP TONIGHT FRI 6PM

We will be discussing what Azure Stack is, how does it fit into the suit of offerings that Azure has currently, and where can it fit into your organizations technology stack. We will also be discussing limitations of the platform while covering various applicable scenarios.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question