I'm using the Form Helper in Lithium and wonder how to add the HTML attributes class
and id
to the output of $this->form->create();
? I want to set these attributes on the form
element.
Asked
Active
Viewed 132 times
1

lorem monkey
- 3,942
- 3
- 35
- 49
1 Answers
2
As intuitive as $this->form->create(null, ['class' => 'foo', 'id' => 'bar'])
NB: replace null
with $something
if you are binding an object to the form.

Mehdi Lahmam B.
- 2,240
- 16
- 22
-
Thanks - somehow this didn't work for 20 minutes as I tried variations of this :/ But/And I think it must be `$this->form->create(null, array('class' => 'foo', 'id' => 'bar'))`. – lorem monkey Aug 30 '13 at 18:02
-
1yep that depends on your php version and array syntax ;-) – Mehdi Lahmam B. Aug 30 '13 at 18:11