0

I am trying to implement jquery validation in my symfony2 project.If i apply class="required " in a text field, the validation works fine but when try to apply custom validation like

$("#checkoutForm").validate({  
    rules: {
        checkout_name: {
            required:true
        } 
    }
});
5
  • Does your Custom validation methods accepts an object({})? Can you post the code of the custom method? Commented Sep 4, 2012 at 7:38
  • 1
    Did you read the source and specially the input name ? Symfony prefixes fields with the name of the form, perhaps the solution (myform_checkout_name) ? Commented Sep 4, 2012 at 7:40
  • @dshai i have edited the code.This is exactly the code that i am using excrpt the `$(document).ready line which is obvious Commented Sep 4, 2012 at 7:43
  • @Shaun As commented by Sybio Have you also verified the page source for the input's name is it same as the one you're using in your validation code? Commented Sep 4, 2012 at 8:44
  • input name is checkout[name] but it gives error like missing operator after id thats y i m using by ID Commented Sep 4, 2012 at 9:01

1 Answer 1

1

Try this one

$("#checkoutForm").validate({  
    rules: {
        'checkout[name]': {
            required:true
        } 
    }
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.