We help IT Professionals succeed at work.
Get Started

mutipe rules in form validation

promediagrp
promediagrp asked
on
309 Views
Last Modified: 2012-05-09
Hi
I'm using jquery.validate.js . I have the following code in the head
  <script type="text/javascript">
      $.metadata.setType("attr", "validate");  
 
      $(document).ready(function(){
        $("#subscriptionForm").validate({
          rules: {
            cemail: "required email",
            cemail_again: {
              equalTo: "#cemail" ,
                    
                   cpassword: "required password",
                  cpassword_again: {
              equalTo: "#cpassword"
                        }
                  }
          }
        });
      });
  </script>

If I place more than one rule in this code, only one part works, (i,e., the form will check that the two email fields match, or that the 2 passwords match, not both sets. So, if I omit the password code, the email works fine, and visa versa. Can anyone help? Here is a link to the form, http://www.districtadministration.com/layouts/subscriptions/print_subscribe.html

Thank you in advance,
Sharon
Comment
Watch Question
Sr. System Analyst
Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE