Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Aug 2002
    Thanked 0 Times in 0 Posts

    help with radio button validation

    Can someone help me??

    I have an asp form with 4 radio buttons and i want to have one button chosen before the form is submitted. I have this code snippet but if I do not check a button, the form still submits:
    <SCRIPT language="JavaScript">

    function Validate() {

    if ((document.contest.Website.check == true) || (document.contest.Radio.checked == true) || (document.contest.Print.checked == true || (document.contest.Other.checked == true) {
    return true;
    else {
    return false;



    <form method="post" action="contest.asp" name="contest" onSubmit="return Validate()">

    <input type="radio" value="1" name="q1>Website
    <input type="radio" value="1" name="q1">Radio
    <input type="radio" value="1" name="q1">Print Ad
    <input type="radio" value="1" name="q1">Other

    How do I get the form to give a message stating that a button needs to be checked and to not submit if a button is not checked??

    Can someone help me???

  • #2
    Join Date
    Sep 2003
    Thanked 0 Times in 0 Posts
    Try searching the forum. Radio button validation is an often asked and answered question and a search should return numerous results, any of which should provide the solution.



    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts