I had a similar issue a while back. I can't find the reference now, but I'm 
sure I read an article that confirmed that in some cases the helper creates a 
PUT rather than a POST. The only reference I can see now is 
http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#creating-forms 
that states it's a POST on create and a PUT on edit (read the second 'output'; 
"Since this is an edit form, a hidden input field is generated to override the 
default HTTP method."). Could that be what's happening in your case?

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 7 May 2013, at 21:17:40, "Advantage+" <[email protected]> wrote:

> Right I understand all that, thanks.
>  
> My question is more about why Cake is changing 1 of the forms to PUT when 
> it's set as POST.
> All forms are created using the Html helper, all forms have the same  1 
> hidden input which all show up with _method = post in the hidden div on all 
> form, all run thru the same jQuery submit function yet 1 form somehow is 
> getting converted to PUT.
>  
> I have deleted records so there is no existing record to PUT so it should be 
> POST, no matter what this 1 form will not accept POST.
>  
> There must be 50 forms / users / admin to add edit data and all use the same 
> function, same js, all have the 1 hidden field, all go to POST except 1 form. 
> This is what puzzles me since it is just the one form. Not so much the 
> functionality of the POST vs PUT but rather why just this 1 form.
>  
> Thanks,
>  
> Dave
>  
> From: [email protected] [mailto:[email protected]] On Behalf 
> Of André Luis
> Sent: Tuesday, May 07, 2013 4:06 PM
> To: [email protected]
> Subject: Re: POST form changes to PUT
>  
> The "PUT" method is when you are updating something, but cake doesnt really 
> uses the put method, but a hidden field with "PUT" as value... So when you 
> have a populated data, even if you´re not updating but creating, it will 
> recognize as PUT
>  
> But both methods will get submited as well, and will have the same data 
> structure, so you can work with both "PUT" or "POST" method the same way, all 
> you need to do is to check not only if the request is "post" but also check 
> if the request is "put"
> 
> Em segunda-feira, 6 de maio de 2013 15h47min55s UTC-3, advantage+ escreveu:
> Running into a weird issue where my form as rendered the HTML shows:
>  
> <form id="EditProfile" class="form-horizontal" accept-charset="utf-8" 
> method="post" action="/manage/profile">
>  
> This form is submitted using ajax and the function is used by many forms thru 
> the site:
> $.ajax({
>                 type: "POST",
>                 url: $(sel).attr('action'),
>                 data: $(sel).formSerialize(),
>                 dataType: 'json',
>  
> And in the controller I have if($this->request->is('ajax') && 
> ($this->request->is('post'))
>  
> But it fails on this 1 form because for some reason it is changing to PUT.
>  
> Are there reason why this would be happening? I looked at a few of my forms 
> using this js function and all of the forms and all are set up the exact same 
> way / Form->helper standard inputs / selects.
>  
> I even added into the form with issues 'method' => 'POST' (upper and lower) 
> but it still fires off a PUT request. Renders as POST but inspecting the 
> request shows:
>  
> application/x-www-form-urlencoded
> _methodPUT
>  
> Ideas would be welcome.
> -- 
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>  
> --- 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  
> 
> -- 
> Like Us on FaceBook https://www.facebook.com/CakePHP
> Find us on Twitter http://twitter.com/CakePHP
>  
> --- 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/cake-php?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.    

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to