I have this form:
class Request_Form_Prova extends Zend_Form
{
public function init()
{
$this->setMethod('post');
$SubForm_Step = new Zend_Form_SubForm();
$SubForm_Step->setAttrib('class','Step');
$this->addSubform($SubForm_Step, 'Chicco');
$PrivacyCheck = $SubForm_Step->createElement('CheckBox', 'PrivacyCheck');
$PrivacyCheck->setLabel('I have read and I agre bla bla...')
->setRequired(true)
->setUncheckedValue('');
$PrivacyCheck->getDecorator('Label')->setOption('class', 'inline');
$SubForm_Step->addElement($PrivacyCheck);
$SubForm_Step->addElement('submit', 'submit', array(
'ignore' => true,
'label' => 'OK',
));
}
}
That generate this HTML:
<form enctype="application/x-www-form-urlencoded" method="post" action="">
<dl class="zend_form">
<dt id="Chicco-label"> </dt>
<dd id="Chicco-element">
<fieldset id="fieldset-Chicco" class="Step">
<dl>
<dt id="Chicco-PrivacyCheck-label"><label for="Chicco-PrivacyCheck" class="inline required">I have read and I agre bla bla...</label></dt>
<dd id="Chicco-PrivacyCheck-element">
<input type="hidden" name="Chicco[PrivacyCheck]" value=""><input type="checkbox" name="Chicco[PrivacyCheck]" id="Chicco-PrivacyCheck" value="1">
</dd>
<dt id="submit-label"> </dt>
<dd id="submit-element">
<input type="submit" name="Chicco[submit]" id="Chicco-submit" value="OK">
</dd>
</dl>
</fieldset>
</dd>
</dl>
</form>
How can I add a class="Test" to the <dd id="Chicco-element"> elemnt?
In order to have it like that: <dd id="Chicco-element" class="Test">
I thought something like that but it don't work:
$SubForm_Step->getDecorator('DdWrapper')->setOption('class', 'Test');
OR
$SubForm_Step->getDecorator('DtDdWrapper')->setOption('class', 'Test');
How can I do it?
And last question:
How can I wrap that DD and DT element of a SubForm in another DL element?
Like that: ( second line )
<dl class="zend_form">
<dl>
<dt id="Chicco-label"> </dt>
<dd id="Chicco-element">
<fieldset id="fieldset-Chicco" class="Step">
<dl>
.......