Re: Form validation

by "Frank Boumphrey" <bckman(at)ix.netcom.com>

 Date:  Tue, 3 Apr 2001 23:49:07 -0400
 To:  <chip.wiegand(at)simrad.com>,
<hwg-techniques(at)hwg.org>
 References:  simrad
  todo: View Thread, Original
if (fm1.rb1.value=="")

or

if (fm1.rb1.checked==true)

depending on your needs,should do the trick

Frank
----- Original Message -----
From: <chip.wiegand(at)simrad.com>
To: <hwg-techniques(at)hwg.org>
Sent: Tuesday, April 03, 2001 2:18 PM
Subject: Form validation


>
>
> I am having a problem with validating form radio buttons. I can
validate the
> text boxes just fine.
> How do I test for a radio button being checked? I have a form that
has several
> text boxes
> (name, address, phone number, city, state, zip), a question with 5
radion
> buttons, another question
> with 8 radion buttons, another question with 2 radion buttons, one
submit button
> at the bottom of it all.
> The text boxes are validated like this -
>
> <script LANGUAGE="JAVASCRIPT">
>
> <!--
> function Verify()
> {
>   var Dealer = document.form1.Dealer.value;
>   var DateInstalled = document.form1.DateInstalled.value;
>   var Owner = document.form1.Owner.value;
>   var Address1 = document.form1.Address1.value;
>   //if (Question_Type == true)
>      {
>                 if (Dealer == "")
>                 {
>                 alert('You have not specified the name of the Simrad
Dealer you
> bought your product from.')
>                 return false
>                 }
>                 if (DateInstalled == "")
>      {
>                 alert('You have not provided the date the product
was
> installed.')
>                 return false
>                 }
>                 if (Owner == "")
>      {
>                 alert('You have not provided your name.')
>                 return false
>                 }
>                 if (Address1 == "")
>      {
>                 alert('You have not provided your address.')
>                 return false
>                 }
>     //}
> }
> //-->
>
> </script>
>
> And so on for all text boxes. I haven't figured out how to validate
the radion
> buttons. I have seen
> many web sites with info about  this but they have a submit button
just for the
> radion buttons and
> no text boxes mixed into the form. The above code is a piece of the
whole
> warranty registration
> form for my company web site.
> Can someone enlighten me? I'd like to just continue the same
function as above
> to include the
> radio buttons, if possible.
> --
> Chip
>
>

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA