Ajaxify Your Zend_Form Validation with jQuery




Zend Screencasts: Video Tutorials about the Zend PHP Framework  (iphone) show

Summary: <p>We’re going to take what was put together in the last 3 videos and now include some server-side validation that will appear asynchronously. This is an example of using Zend_Form as a validation tool via JSON.</p> <p>Grab a <a href="http://zendcasts.googlecode.com/svn/trunk/zc52-ajaxify-your-validation-with-jquery/zc52-ajaxify-your-validation-with-jquery.zip">copy of the project</a> or <a href="http://code.google.com/p/zendcasts/source/browse/#svn/trunk/zc52-ajaxify-your-validation-with-jquery">browse the repository</a>.</p> <p><strong>UPDATE: </strong> as a couple people have mentioned, you can cut down your IndexController even more by using the Zend_Json view helper:<br> <code><br> public function validateformAction()<br> {<br> $f = new Form_Registration();<br> $f-&gt;isValid($this-&gt;_getAllParams());<br> $this-&gt;_helper-&gt;json($f-&gt;getMessages());<br> }<br> </code></p> <p>Enjoy!</p>