> hi
>
> i try so hard injecting a html code after <form> in my zend_form object
>
> i also try creating a custom form_element
>
> but not works
>
> actually dont know how to set the html code of a element
>
> any possible way?
What is your use case of the html? If it is always the same, you could look at
view helpers. Instead of printing your form, you use the view helper:
<?php echo $this->form?>
<?php echo $this->extendForm($this->form)?>
You create a view helper which accepts a Zend_Form object and renders some
html after it:
<?php
public function extendForm(Zend_Form $form)
{
return $form->__toString() . $this->_html();
}
public function _html ()
{
return '<p>This is my HTML</p>';
}
Otherwise, if it's really a part of the form (e.g. some controls), you can
create a decorator. In you init() of your form, you can do something like:
<?php
public function init()
{
// Add your elements
$this->loadDefaultDecorators();
$this->addDecorator('myControls');
}
Regards, Jurian
--
Jurian Sluiman
Soflomo - http://soflomo.com
没有评论:
发表评论