2011年1月23日星期日

Re: [fw-mvc] inject a html code after <form>

I tried
http://framework.zend.com/apidoc/core/Zend_Form/Zend_Form.html#setDescription
... before
not showing ... maybe a bug !

On Sun, Jan 23, 2011 at 2:06 PM, Kaiuwe <dr.kaiuwe@googlemail.com> wrote:

> Or simply use the opportunity to set a description for the form:
> http://framework.zend.com/apidoc/core/Zend_Form/Zend_Form.html#setDescription
>
> Am 23.01.2011, 11:31 Uhr, schrieb Jurian Sluiman <
> subscribe@juriansluiman.nl>:
>
>
> On Sunday 23 Jan 2011 10:48:49 sina miandashti wrote:
>>
>>> 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
>>
>
>


--
________________
Sincerely
Sina Miandashti
MuSicBasE.ir & InvisionPower.ir Admin

没有评论: