Thanks a lot for your reply Matthew.
I have no problem with rendering of my elements and i took reference from ZF
manual(15.5.3. Custom Decorators).
My Question is why checkbox not retains value (for scenario : I have two
fields both are required checkbox and textbox,now when i wont feel the text
box and check the checkbox and click on Submit   it becomes unchacked which
is not the proprer behavior )when i wrote the custom decorator and it retain
without custom decorator,Will i need to change the decorator or what else?
Once again thanks for your reply,looking towords for correct answer
Regards
Rohit

Matthew Weier O'Phinney-3 wrote:
> 
> -- Rohit83 <[EMAIL PROTECTED]> wrote
> (on Wednesday, 09 July 2008, 05:04 AM -0700):
>> 
>> Hi All
>> I have check box element in form and have written the custom decorator
>> for
>> this form in that i have written one function as given in the
>> documentation.
>>
>> public function buildInput()
> 
> Um... what documentation were you reading? the method should be
> 'render', not buildInput(), and should expect the argument '$content':
> 
>     public function render($content)
> 
> Change to that, and you should get an element rendered. :)
> 
> Now, as to retaining the value... an interesting thing about checkboxes
> is that if it is not checked, no value is submitted for the element. The
> FormCheckbox helper, which is used by default, actually prepends a
> hidden element with the un-checked value so that a value will always be
> submitted. If you're not using that for your helper, you'll need to do
> similarly with whatever logic you use.
> 
>>     {
>>         $element = $this->getElement();
>>         $helper  = $element->helper;
>>         return $element->getView()->$helper(
>>             $element->getName(),
>>             $element->getValue(),
>>             $element->getAttribs(),
>>             $element->options
>>         );
>>     }
>> 
>> Now  when i submit this form and if the error occurs on any element this
>> checkbox never retain its value,Will anybody suggest me the way,where i
>> am
>> lagging behind because this happens only for checkboxes,(and if i never
>> use
>> this custom decorator then it retains value even if error occur but i
>> need
>> custom decorator).So please help me out
> 
> -- 
> Matthew Weier O'Phinney
> Software Architect       | [EMAIL PROTECTED]
> Zend Framework           | http://framework.zend.com/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/values-for-checkbox-and-populate-method-tp18359443p18361835.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to