How to set form name and id using cakephp FormHelper class?
12,172
You can simply pass any additional attributes in the $options
parameter. If there's no special meaning for Cake (like url
), it'll use it as HTML attributes:
echo $form->create('Model', array('id' => 'myId'));
<form id="myId" method="post" action="/models/add">
Related videos on Youtube
Author by
chiggsy
Updated on June 04, 2022Comments
-
chiggsy almost 2 years
I'm trying to create a form using Cakephp's FormHelper class. The form needs to have a name and and an id. I fail to see an option for that however.
Looking at the documentation for the Formhelper, I see a lot of things, but not a way to set name and option. It's not in the source for the Formhelper either. How are these values set?
Cakephp v1.2 is the version of cake i'm running here
EDIT: the form is being submitted to an external destination. It is not a form associated with any model in the app.
-
chiggsy almost 14 yearsMuch appreciated. I was just about to look into extending the class, which reeked of overkill.