DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  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)

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links