Monday, May 6, 2013

POST form changes to PUT

Running into a weird issue where my form as rendered the HTML shows:

 

<form id="EditProfileclass="form-horizontalaccept-charset="utf-8method="postaction="/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.

No comments: