Form validation with Ajax
I have started an FAQ article in the CakePHP Wiki about form validation with Ajax. With a simple example I show how to display messages depending on the text you enter, and how to submit your form only when all input fields are filled out correctly. Feedback is welcome!




Hey, I copied your post (almost exaclty). It looks like it could work great, except that everytime the function ajaxValidateUsername is called in the controller, it causes my default layout to render inside the div instead of just labelText. I’ve added $this->layout = “ajax”; but it doesn’t do any good. Any ideas what i need to change in order to get it to just print the message in labelText?
thanks
Hm, have you tried $this->render(’viewname’, ‘ajax’); ? Or the RequestHandler component: $this->RequestHandler->setAjax($this);
HTH
hi as the wiki has been removed where is the information now.. as this article..
@Arvind Thakur: You can find at least some information in the bakery (http://bakery.cakephp.org) or in the manual (http://manual.cakephp.org). And the content of the wiki is probably still available via Google’s cache. HTH