you need to check 'checked' not length, the length
will always be the number of total boxes witht that
name
--- Ryan Everhart <[EMAIL PROTECTED]> wrote:
> Ok guys I know this is easy, so please forgive me. 
> I have a form with
> a series of checkboxes in it.  The checkboxes are
> all named the same
> so when the form is submitted I get a comma
> delimited list of values
> like 1,4,5,8.  I then take that list and  put it in
> my db.  Well I'm
> getting errors from my app now because people are
> not selecting any
> check boxes.  So I'm trying to right some JS that
> will make sure at
> least on check box is check.  Below is what I have,
> but it does seem
> to be working like I'd like it to.
> 
> This simply just checks if the value of the boxlist
> variable coming
> from the form is greater than 0.  Keep in mind the
> BoxList variable is
> the name of several check boxes in the form so it
> should read like
> 1,4,5,8.  It seems that every time I submit the form
> it passes the
> 'thisForm.BoxList.length' check every time no matter
> if any boxes are
> checked or not.
> 
> <SCRIPT LANGUAGE="JavaScript">        
> function CheckBoxCheck(thisForm)      
>       {
>       if (thisForm.BoxList.length == 0) 
>               {
>               alert("Please select at least one checkbox.\n");
>               return false;
>       }
>       }
> </script>
> 
> 
> I know I'm just missing something simple.  Any
> thoughts?
> 
> Thanks,
> Ryan
>
----------------------------------------------------------
> To post, send email to [email protected]
> To unsubscribe:
>    http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
> To subscribe:
>   
> http://www.dfwcfug.org/form_MemberRegistration.cfm
> 
> 
> 

Anthony C. Frey
214-529-1507
[EMAIL PROTECTED]
 
 



                
Yahoo! Mail
Stay connected, organized, and protected. Take the tour:
http://tour.mail.yahoo.com/mailtour.html

----------------------------------------------------------
To post, send email to [email protected]
To unsubscribe: 
   http://www.dfwcfug.org/form_MemberUnsubscribe.cfm
To subscribe: 
   http://www.dfwcfug.org/form_MemberRegistration.cfm


Reply via email to