chiggsy
chiggsy

Reputation: 8463

How to set form name and id using cakephp FormHelper class?

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.

Upvotes: 3

Views: 12285

Answers (1)

deceze
deceze

Reputation: 522597

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">

Upvotes: 10

Related Questions