Yes,

this seems to work:

    $this->widgetSchema['tsandcs'] = new sfWidgetFormInputCheckbox();

    $this->setValidator('tsandcs', new
sfValidatorBoolean(array('required'=>true)));



On May 16, 1:53 pm, Bart van den Burg <bart0...@gmail.com> wrote:
> Won't simply setting "required"=>true do the trick?
>
> On May 16, 1:58 pm, codecowboy <l...@lukem.co.uk> wrote:
>
>
>
> > Hi,
> > I can't find an example of how to add a required checkbox to a form
> > which is unrelated to my model e.g a checkbox to accept the terms and
> > and conditions for registration.
>
> > I think maybe what I need is something like:
>
> >     $this->widgetSchema['tsandcs'] = new sfWidgetFormInputCheckbox();
>
> >     $this->setValidator('tsandcs', new sfValidatorBoolean());
>
> > But how do I force validation so that the form will only validate if
> > the checkbox is checked?
>
> > Symfony version is 1.4
>
> > thanks!

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to