Reputation: 4774
So I have a form on my website that will submit a name and email address. I want to submit them with ajax which is simple to do, but I wanted to verify that both fields are filled in and that the email is in the correct email form.
Basically I want to run some client side validation on the fields before submitting it via ajax. Does anyone know how to do this with symfonys ajax remote helper methods?
Upvotes: 1
Views: 2372
Reputation: 4726
If you are using Symfony 1.2 and sfForms, you can use a plugin called sfJqueryFormValidationPlugin:
http://www.symfony-project.org/plugins/sfJqueryFormValidationPlugin/0_9_1
It takes care of producing the right Javascript to validate fields. In your case, it'll just be checking that the fields have been filled.
This link has a more thorough tutorial:
http://blog.adryjanek.eu/2009/01/15/symfony-12-using-sfform-with-jquery-validate-plugin/
Hope this helps :)
Upvotes: 1