Script to make sure at least one option is ticked in a submittal form

I am at an end to add a code to check my form to be sure that one of the options on my form are ticked. I have been researching EE with no success. Please forward needed code to check the option buttons. I am very new to working with submittal forms.
Thanks

Robert
<script language="javascript" type="text/javascript">
function isValidEmail(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
 }
function IsEmpty(aTextField) {
   if ((aTextField.value.length==0) ||
   (aTextField.value==null)) {
      return true;
   }
   else { return false; }
}	
function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
    }
function ValidateForm(form)
{
   if(IsEmpty(form.firstname)) 
   { 
      alert('Please enter your First Name!') 
           return false; 	  
   } 
   
   if (!isValidEmail(form.email.value)) 
   { 
      alert('Please enter correct email address!') 
         return false; 
      } 
   if(IsEmpty(form.comments)) 
   { 
      alert('Please enter your comments!') 
     // form.account_number.focus(); 
      return false; 	  
   }  
return true;
 } 
</script>
 
</HEAD>
<BODY>
<FORM action="formmail_response.cfm" method="post" onsubmit="javascript:return ValidateForm(this)">
 
<P><INPUT type=hidden value=robert@rwsmin.org name=_recipients> <INPUT 
type=hidden value="Rowsen IT Applications: " name=_subject> 
<P>Required Information is marked ( <span class="style1">*</span> ) 
<P>First Name <span class="style1">*</span>: 
  <input name="firstname" type="text"> 
  <P>Last Name:
  <input name="lastname" type="text"> 
  <P>Phone Number : 
    <input name="phonenumber" type="text"  size="20" maxlength="20">
  <P>    Email Address <span class="style1">*</span>: 
    <input name="email" size="35">  
  
  <P>    Comments <span class="style1">*</span>:<BR>
  <TEXTAREA name="comments" cols=58 rows=9></TEXTAREA>   
  <P>Option Is Required  ( <span class="style1">*</span> )   
  <P>
    <input name="InfoRequested" type="radio" value="I have no request from the list below.">
I have no request from the list below.<P>
  <input name="InfoRequested" type="radio" value="I would like information concerning foodservice.">
  I would like information concerning foodservice. <P>
  <input name="InfoRequested" type="radio" value="I would like information concerning a business application.">
  I would like information concerning a business application.<P>
    <input name="InfoRequested" type="radio" value="I would like information concerning Bible Information ">I would like information concerning Bible Information 
    <BR><br>
    <INPUT type=submit value=Submit> 
    <INPUT type=reset value=Clear>

Open in new window

rowsenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

xunrage_Commented:
As far as I see in your code, you don't have a default option selected for radiobox group InfoRequested. Select one one option as default and then there will be always an option selected into that radiobox group. You can do that by adding checked="checked" like in the following snipet:
<p><input name="InfoRequested" type="radio" checked="checked" value="I have no request from the list below.">I have no request from the list below.</p>
0
Frosty555Commented:
If you want to make sure one is checked... you can use this validation code:
function ValidateForm(form)
{
   if(IsEmpty(form.firstname)) 
   { 
      alert('Please enter your First Name!') 
           return false; 	  
   } 
   
   if (!isValidEmail(form.email.value)) 
   { 
      alert('Please enter correct email address!') 
         return false; 
      } 
   if(IsEmpty(form.comments)) 
   { 
      alert('Please enter your comments!') 
     // form.account_number.focus(); 
      return false; 	  
   }  
 
   var valchecked = false;
   for( i = 0; i < document.myform.InfoRequested.length; i++ )
   {
       if( document.myform.mygroup[i].checked == true )
       {
          valchecked = true;
          break;
       }
   }
   if(!valchecked) 
   { 
      alert('Please check one of the radio buttons!');
      return false; 	  
   }  
   
   return true;
 } 

Open in new window

0
Frosty555Commented:
whoops, forgot to replace some variable names there ;)
function ValidateForm(form)
{
   if(IsEmpty(form.firstname)) 
   { 
      alert('Please enter your First Name!') 
           return false; 	  
   } 
   
   if (!isValidEmail(form.email.value)) 
   { 
      alert('Please enter correct email address!') 
         return false; 
      } 
   if(IsEmpty(form.comments)) 
   { 
      alert('Please enter your comments!') 
     // form.account_number.focus(); 
      return false; 	  
   }  
 
   var valchecked = false;
   for( i = 0; i < form.InfoRequested.length; i++ )
   {
       if( form.InfoRequested[i].checked == true )
       {
          valchecked = true;
          break;
       }
   }
   if(!valchecked) 
   { 
      alert('Please check one of the radio buttons!');
      return false; 	  
   }  
   
   return true;
 } 

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rowsenAuthor Commented:
Thank you guys for your help, both these answers were very helpful.

Robert
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.