Reputation: 1122
Trivial, but I swear I cannot find the information anywhere.
<?php $username = $this->form->username ?>
<?php echo $username->renderViewHelper() ?>
What does renderViewHelper() do here?
Upvotes: 3
Views: 1440
Reputation: 25745
at times, you may want to use Zend_Form with the existing markup in the view, for example consider the below markup that is to be found in view file.
<form method="<?php echo $form->getMethod() ?>" action="<?php echo $form->getAction()?>">
<div id="elements">
<?php echo $form->element1->renderLabel() . $form->element1->renderViewHelper() ?>
<?php echo $form->element2->renderLabel() . $form->element2->renderViewHelper() ?>
</div>
</form>
the below syntax
$form->element1->renderLabel()
will fetch only the label tag. no fancy wrapper tags or anything. the same goes to
$form->element1->renderViewHelper()
this will only fetch the input (or whatever specified) element tag. so that you can embed the form with your own existing markup instead of allowing zend_form
to create markup by itself.
check this link for more information http://framework.zend.com/manual/en/learning.form.decorators.individual.html
hope this helps you.
Upvotes: 6
Reputation: 33148
It renders the form element, specifically the viewHelper
decorator from the form element, which is the one that renders the element itself (without any additional markup).
Upvotes: 1