I am attempting to use the same input form for both add and edit
actions.
echo $this->Form->create('Clon');
So, when I create the form as above, then access the output via both
add and edit actions I see the following html generated:
<form action="/GPDdev/clons/add"
id="ClonEditForm"
method="post"
accept-charset="utf-8">
<input type="hidden"
name="_method"
value="POST"/>
<form action="/GPDdev/clons/edit/18"
id="ClonEditForm"
method="post"
accept-charset="utf-8">
<input type="hidden"
name="_method"
value="PUT"/>
Now, if I understand the cookbook correctly,
(http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html)
the hidden input field is generated to override the default HTTP post
method with the appropriate POST or PUT method.
Which it appears to do. Am I correct so far?
So again, why is the condition on the edit function this:
if ($this->request->is('post') || $this->request->is('put'))
and not this?:
if ($this->request->is('put'))
McS
On Feb 13, 2:35 pm, McScreech <[email protected]> wrote:
> No one willing to explain this one?
>
> On Feb 6, 11:12 am, McScreech <[email protected]> wrote:
>
> > OK, I get that. Then the core of my question is:
> > The condition in add function makes sense to me:
> > if ($this->request->is('post'))
>
> > But why does the edit function use this:
> > if ($this->request->is('post') || $this->request->is('put'))
>
> > and not this?:
> > if ($this->request->is('put'))
>
> > McS.
>
> > On Feb 1, 12:25 pm, Thiago Belem <[email protected]> wrote:
>
> > > AFAIK, PUT is the POST HTTP Request version of "edit" action... when you
> > > send data that u want to change something (not insert) you send a PUT
> > > request.
>
> > > ***Thiago Belem*
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php