-- 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/

Reply via email to