How can I set the form name and id using the CakeFp FormHelper class?

I am trying to create a form using Cakephp's FormHelper class. The form must have a name and ID. However, I see no possibility for this.

Looking at the documentation for Formhelper I see a lot of things, but no way to set the name and variant. It's not in the source for Formhelper. How are these values ​​set?

Cakephp v1.2 is the version of the cakes I am running here

EDIT: The form is being submitted to an external destination. It is not a form associated with any model in the application.

+2


a source to share


1 answer


You can simply pass any additional attributes in the parameter $options

. If Cake has no special meaning (for example url

), it will use it as HTML attributes:



echo $form->create('Model', array('id' => 'myId'));

<form id="myId" method="post" action="/models/add">

      

+8


a source







All Articles