I would like to create a form with a label that would contain two different styles, for example:
“Email (enter your email):”
How can I do that? Right now I am using the label attribute of the addElement() method:
$form->addElement('text', 'email', array(
'label' => 'Email',
'required' => true,
));
With this method I only get a label attribute to the form tag, and can’t use different styling inside it.
Thank you!
Do you already use the
Labeldecorator ?If yes, just use this code :
And this is done. I just added the
<strong>tag to the label, and asked theLabeldecorator not to escape this tag.It’s also working for any html content. This is how I could put images in some checkboxes labels 🙂 (country flags to choose the language)