Thanks for the answer, but I'd love a little more guidance myself.
Can you answer OP's Q1, which is the difference between $ajax->form
and $ajax->submit?
Also, please explain the $this->render('view','ajax'); line of code?
There is nothing in the API (http://api.cakephp.org/1.2/
class_controller.html#90046e6b62c91452a987c9573372c2ac) about a
special 'ajax' value as a layout option. What does this do? Does it
render no layout if the request was ajax? How does the action know
whether an incoming request is coming from an Ajax source or not?
On Feb 23, 4:54 pm, "b logica" <[EMAIL PROTECTED]> wrote:
> 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 simpleAjaxbasedform. 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 theform,
> > I get redirected back to the index view showing the modified or added
> > record. All fine!
> > But, when theformvalidation fails, I get redirected to theform
> > 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->formhelper call in theformview. Telling the $ajax->form
> > function to update the div element.
>
> > Q1) what's the difference in using $ajax->formand $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 theformvalidation 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 anajaxrequest. It renders the content in the default
> > layout.
>
> > I'm obviously missing the point somewhere
> > Q2) how can you make sure thatformstays in the div, but when it
> > validates you get a non-ajaxredirect?
>
> > 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
-~--~~~~--~~--~--~---