I have a dynamic 2d array of checkboxes, and I want to require that at
least one is selected. Trying to write validation rules for this is
proving to be excruciatingly difficult.

The only way I could accomplish this is to override the isValid
function and put in some logic to manually check each box.

It causes the form not to validate, but obviously does nothing to the
error schema:

    public function isValid()
    {
        $result=false;

        foreach($this['requiredServices'] as $service)
        {
            foreach($service as $region)
            {
                if($region->getValue())
                {
                    $result=true;
                    break;
                }
            }
        }


        return $result && parent::isValid();
    }



Is there a better way than this?

Thanks

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