El grupo al cual envías entradas es un grupo Usenet. Si envías mensajes a este grupo, cualquier usuario de Internet podrá ver tu dirección de correo electrónico
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?
I regularly overwrite this method just to change the flash messages
from "item" to the proper object name or redirect to a different page
altogether.
Seems a good idea to break this functionality apart.
Daniel
On Oct 27, 9:12 am, ashton <ahonn...@gmail.com> wrote:
> 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?
> I regularly overwrite this method just to change the flash messages
> from "item" to the proper object name or redirect to a different page
> altogether.
> Seems a good idea to break this functionality apart.
> Daniel
> On Oct 27, 9:12 am, 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?
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?
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?
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.
> 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?
I haven't heard anything else about this after the upvotes, but If
anyone can enlighten me as to what if anything is going on with this?
If not, if there is another place to request that the admin generator
action be ajax friendly.
thanks
ashton
On Nov 5, 1:45 pm, ashton <ahonn...@gmail.com> wrote:
> 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.
> 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?