true, you can't use required for that one. When checked the value is default
'1', not checked default '0'. So there's always a value passed and required
is always true. So I would use a validator e.g. Identical and check for
value '1'. Or you can use the validator GreaterThan and check if it's
greater than '0'... 
Or write your own validator...


Giorgio Sironi wrote:
> 
> How can I create a required checkbox in my class that extends Zend_Form?
> Suppose I am in init() method.
> I want the form being not valid if checkbox isn't checked.
> This does not work:
>              ->addElement('Checkbox', 'privacy', array(
>                                           'label' => 'Sottoscrive
> l\'assenso
> alla gestione dati (informativa sulla privacy da inserire)',
>                                           'required' => true
>                                            ))
> 
> -- 
> Giorgio Sironi
> Piccolo Principe & Ossigeno Scripter
> http://www.sourceforge.net/projects/ossigeno
> 
> 


-----
visit my website at  http://www.phpscriptor.com/ http://www.phpscriptor.com/ 
-- 
View this message in context: 
http://www.nabble.com/Zend_Form-and-required-checkbox-tp21443918p21444716.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to