logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

Re: [FormBuilder] Required Radio Type Disallows Zero: msg#00031

Subject: Re: [FormBuilder] Required Radio Type Disallows Zero
On Mon, Oct 30, 2006 at 09:17:01AM -0500, Steve Schwarz wrote:
> Hi,
> I'm wondering what I'm doing wrong.
> I had this field element and and as soon as I added "required=>1" to its
> definition it fails server side validation if I select zero (0) as its
> value. All other values don't cause a problem. Also server side validation
> succeeds if I remove "required=>1" Any ideas?
>    $form->field(name =>'persistence', type=>'radio', options=>[qw(-4 -3 -2
> -1 0 1 2 3 4), {99=>'N/A'}], required=>1);
> 
> Thanks,
> Steve

I ran into this problem when I wanted to have the user select
height_inches (height_feet done separately).  Here is what works:

        $form->field(name => "height_inches",
                                 label => "",
                                 comment => "Inches",
                                 options => [ 0 .. 11 ],
                                 # This could be "0"
                                 # which will otherwise bust validation.
                                 validate => 'INT',
                                 );

So set the validation as 'INT' and a 0 entry won't bust the
validation.  Sometimes this is a required field and sometimes not, but
that is set separately.

Cheers,
-- 
Bob McClure, Jr.             Bobcat Open Systems, Inc.
bob@xxxxxxxxxxxx             http://www.bobcatos.com
"Where you go in the hereafter depends on what you were after here."
  - Thanks to Graffiti, 2 March 2004
_______________________________________________
FBusers mailing list
FBusers@xxxxxxxxxxxxxxx
http://www.formbuilder.org/mailman/listinfo/fbusers



<Prev in Thread] Current Thread [Next in Thread>