1

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?

2
  • 2
    Just throwing this out there: docs.jquery.com/Plugins/Validation jQuery Validate. No AJAX, just good validation used by a large amount of people. Supports email :) Commented Jan 10, 2010 at 6:53
  • I've used that before. But I am interested in using JavaScript to validate a form prior to submitting it with AJAX, specifically with symfony. Thanks though! Commented Jan 10, 2010 at 8:43

1 Answer 1

1

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 :)

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.