Radio button validation


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Radio button validation

  1. #1
    Join Date
    Apr 2004
    Posts
    9

    Radio button validation

    I am completely new to JS so please bare with me!!!

    I need to capture time and time of day..I have a textbox for the time and am using 2 radio buttons. One for AM and one for PM.

    I want to make sure that one of the radio buttons is checked...

    This doesn't work.... Please HELP!!!!

    if (!document.form1.rdampm == 0)
    {
    alert("Time of day checkbox must be checked");
    return false;}


    This is for the AM:
    <input type="radio" id="rdampm" name="rdampm<%=salesArray(0,i)%>" value="0" <%if salesArray(12,i)=False then Response.Write("checked")%>>AM

    This is for PM:
    <input type="radio" id="rdampm" name="rdampm<%=salesArray(0,i)%>" value="1" <%if salesArray(12,i)=False then Response.Write("checked")%>>PM

  2. #2
    Join Date
    Jun 2004
    Posts
    199
    The radio buttons are an array and the checked value must be evaluated.

    BTW, the best for forum for help on JavaScript is:
    http://news.devx.com/forumdisplay.php?s=&forumid=112

    Java != JS (Javascript)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center