Try this to close your controller action: $this->render('VIEW', 'ajax');
where VIEW is the name of your view. (or element?) On Sat, Feb 23, 2008 at 12:30 PM, brammeleman <[EMAIL PROTECTED]> wrote: > > I'm trying to create a simple Ajax based form. These are the steps > I've taken along with the questions that came up: > > I've managed to get the forms' content into a div element. Done by > creating an 'ajax' instead of an 'html' link. When I submit the form, > I get redirected back to the index view showing the modified or added > record. All fine! > But, when the form validation fails, I get redirected to the form > directly rendered into the layout (instead of in the div element). > > To solve this problem, I've replaced the $form->create helper call by > the $ajax->form helper call in the form view. Telling the $ajax->form > function to update the div element. > > Q1) what's the difference in using $ajax->form and $ajax->submit? > should one of them be used exclusively? or do they need to be used in > a pair (like $form->create and $form->end)? > > Now it works nice when the form validation fails. But when the > submitted data validates, the redirected (index) page gets rendered in > the div. The funny thing is that somehow the requesthanler doesn't > know it's an ajax request. It renders the content in the default > layout. > > I'm obviously missing the point somewhere.... > Q2) how can you make sure that form stays in the div, but when it > validates you get a non-ajax redirect? > > Thanks for your help, > > Bram > > ps: someone else apparently posted a similar question in the bin: > http://bin.cakephp.org/saved/521 > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---