I am creating a form using Cake.In the form there is a
$this->Form->button(“$i”);
element. How do I specify to which function of the controller the data will be posted. If I am not wrong for accessing this data in the Controller,this form element needs to have a name. How do we specify the name for the button. I have been going through the documentation for a long time and dont seem to find any answers. Please advise me.
I am creating a form using Cake.In the form there is a $this->Form->button($i); element.
Share
The button just submits the current form, that’s not where you set the controller action. You do that in the
createmethod of the FormHelper.By default, forms are submitted to the action belonging to the current view that is served, but you can overrule that with the
actionoption when creating your form. Like this:That would submit your form to the Users controller and the
editfunction within that controller.