And code submitting the form in my first post now looks like:
echo $ajax->form('Snack', 'POST', array('update'=>array
('formDiv','centralText',
'url'=>'/updateSnack', 'before'=>'togglePreloader();',
'complete'=>'togglePreloader();'));
On 14 nov, 09:46, Bart <[EMAIL PROTECTED]> wrote:
> I guess in the controller you can "try" to validate the formdata
> first, instead of just "save". "$this->Model->try();" is a method that
> does "save" without the eventual saving, but it does return a Boolean
> whether the formdata is valid or not.
> Depending on that result you can either render('nextPage', 'ajax'); or
> render('formPageWithErrorMessages', 'ajax');
>
> /Bart
>
> On 12 nov, 09:54, Kanten <[EMAIL PROTECTED]> wrote:
>
> > I'm quite interested in this as well. Can you tell us more about how
> > you made this work, maybe show your code?
>
> > My problem is that I "disappear" myformafter data is submitted. Can
> > I somehow "not disappear it" when it doesn't validate?
>
> > /Anders
>
> > On Nov 11, 8:51 am, Bart <[EMAIL PROTECTED]> wrote:
>
> > > I just found it.
> > > I needed to ALSO make theAJAXcall update theform.
>
> > > On 10 nov, 22:17, Bart <[EMAIL PROTECTED]> wrote:
>
> > > > Hello there,
>
> > > > I have aformthat I submit with anAJAXcall. TheAJAXcall also
> > > > updates another div in the page. I does not update theformdiv
> > > > itself.
> > > > All goes well, except when theforminput is validated as false there
> > > > is no error message.
> > > > The submission simply stops, the item is not inserted into the
> > > > database and a new submit attempt can be made.
>
> > > > When I do the submission by a regular POST call (noAJAX), I do get
> > > > the right error message.
> > > > Is there a workaround?
> > > > Theajaxformcode looks as follows:
>
> > > > echo $ajax->form('Snack', 'POST', array('update'=>'centralText',
> > > > 'url'=>'/updateSnack', 'before'=>'togglePreloader();',
> > > > 'complete'=>'togglePreloader();'));
>
> > > > Thanks,
> > > > Bart
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---