I added another check in the processFormAction file that catches the invalid form case
processFormAction.php 33a34,38 > elseif ($request->isXmlHttpRequest()) > { > $notice = array('error' => 'The item has not been saved due to some > errors.'); > return $this->renderText(json_encode($notice)); > } Additionally the setTemplate line int the executeCreate method would need to be altered in order for the executeCreate action to be ajax usable out of the box. createAction.php 8c8,12 < $this->setTemplate('new'); --- > if ($request->isXmlHttpRequest()) { > return sfView::NONE; > } else { > $this->setTemplate('new'); > } On Nov 2, 9:27 pm, ashton <ahonn...@gmail.com> wrote: > That works great for me, except in the case of the $form->isValid > check failing. That bypasses the patched code and just uses the > regular edit template. > > On Oct 27, 12:11 pm, david <da...@inspiredthinking.co.uk> wrote: > > > > > Attached is a quick patch for Doctrine that will generate Ajax aware > > actions on processForm - and is for Symfony 1.3-beta1. > > The file that should be patched is > > lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineMo > > dule/admin/parts/processFormAction.php > > (only the filename is in the attached patch). > > > Give it a try and if all is ok - I'll do one for Propel and raise a ticket. > > > On Tue, 27 Oct 2009 17:12:00 +0100,ashton<ahonn...@gmail.com> wrote: > > > > Hi, apologies if this goes somewhere else. > > > > The processForm method generated buy the admin gen binds, checks for > > > validity, saves and then redirects to the appropriate page. However, > > > this makes the processForm method unavailable to ajax actions that > > > want to return JSON. Maybe the save/redir should be in different > > > methods? Or it could only redirect if isXmlHttpRequest() is true? > > > >ashton > > > -- > > Using Opera's revolutionary e-mail client:http://www.opera.com/mail/ > > > adminAjaxNoRedirect.patch > > 2KViewDownload --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony developers" group. To post to this group, send email to symfony-devs@googlegroups.com To unsubscribe from this group, send email to symfony-devs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en -~----------~----~----~----~------~----~------~--~---