4
My problem occurs with the following code:
<?php
echo $this->Form->create(
'Page',
array(
'url' => array(
'controller' => 'pages',
'action' => 'delete',
$this->request->data['Page']['id'],
'admin' => true
),
'id' => 'PageDeleteForm',
'method' => 'POST',
'class' => 'hide'
)
);
echo $this->Form->end();
?>
The result of this is this:
<form action="/admin/pages/delete/16" id="PageDeleteForm" method="post" class="hide" accept-charset="utf-8">
<div style="display:none;">
<input type="hidden" name="_method" value="PUT">
</div>
</form>
With this, Cakephp returns to me: Method not allowed, for mine action
allows only POST
or DELETE
.
Why the field _method
is being generated with the value PUT?
Try to pass
'type'=> 'POST'
instead of method.– bfavaretto
@bfavaretto Problem solved! The question is: why he set the method as POST, and the input as PUT? But anyway, the initial problem was solved. Thank you.
– Patrick Maciel