Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - validating an array  in javaScript
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic Closedvalidating an array in javaScript

 Post Reply Post Reply
Author
RCorr View Drop Down
Groupie
Groupie


Joined: 21 January 2003
Status: Offline
Points: 126
Direct Link To This Post Topic: validating an array in javaScript
    Posted: 03 December 2007 at 7:04pm
Hi there,

I have a form with a series of check boxes with the same name - availability[].   The square brackets makes it as an array of course  :-) .

In javaScript, I am trying to determine if at least one of the check boxes is checked, but my code is producing an error.  This is want I have:

bAvailable = false;

for(var i=0; i < document.volunteer_app("availability[]").length; i++){
 
    if (document.volunteer_app("availability[" + i + "]").checked)
        bAvailable = true;
}

the error occurs on the following line:
  
     if (document.volunteer_app("availability[" + i + "]").checked)

Any suggestions as to what is wrong with my code.

Thanks,

RCorr
  
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.