RE: Form validation

by "Charlton, Mark" <Mark.Charlton(at)saint-gobain.com>

 Date:  Tue, 3 Apr 2001 15:45:17 -0400
 To:  "'chip.wiegand(at)simrad.com'" <chip.wiegand(at)simrad.com>,
hwg-techniques(at)hwg.org
  todo: View Thread, Original
this was covered not long ago on one of these lists.

Try

if(document.form1.radio1.value == null) {
	//error stuff
}

Regards
Mark

-----Original Message-----
From: chip.wiegand(at)simrad.com [mailto:chip.wiegand(at)simrad.com]
Sent: Tuesday, April 03, 2001 2:19 PM
To: hwg-techniques(at)hwg.org
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

This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.