Bryan
Bryan

Reputation: 645

zend form how to add lots of custom html

I have lots of zend_form, and I want to add lots of custom html in them, what are the possible options. For e.g. I have a page where user can attach multiple emails with the account, so I have a field to add new email address and on top of that I want to show add other email addresses user has attached with the account. To display a form field I am using decorators and generating following html
< div>
< label for="accountDetailsForm-email" class="required">Email:< /label>
< input type="text" name="accountDetailsForm[email]" id="accountDetailsForm-email" value="" class="inputText" size="47" />
< /div>

to display the uneditable data I want to generate
< dl>
< dt class="required" >Email: < /dt>
< dd >[email protected]< /dd>
< /dl>

Upvotes: 2

Views: 361

Answers (1)

DarkLeafyGreen
DarkLeafyGreen

Reputation: 70406

There are two things you can do.

The first is to write your own form elements and decorators, which I recommend if you want to reuse your code.

The the other thing is you can use e.g.

$form = $this->form;
echo $form->email->renderViewHelper ();

in the corresponding view file to customize your form, so do not call just

echo $form;

That would echo the form. But echo the elements manually ;)

Upvotes: 1

Related Questions