Richard Parnaby-King

Zend_Form – prefix text using decorator

I want to prefix the form with a title, within the form tags, but above the form elements.

[html]

Login Form


[/html]

Further more, I do not want to use a view script.


[php]
setDecorators(array(
array(
‘Description’,
array(
‘tag’ => ‘h3’
)
),
‘FormElements’,
‘Form’
))
->setDescription(‘Login Form’);
[/php]

Depending where you place the description decorator will determine where in the form tags it displays, i.e. place above ‘FormElements’ to display above the elements; place below ‘FormElements’ to display the description below the elements; place below the ‘Form’ decorator to display after the form tags.