Forum Moderators: open
<script type = "text/javascript"><!--
function checkforms() {
with(document) {
var checkName
var checkEmail
var checkSrc
var checkNewsltr
var itsOkay
itsOkay = 1;
checkNewsltr = verify.newsltr.value;
checkName = verify.name.value;
if (checkName == "")
{
alert ("Your name entry is not valid");
itsOkay = 0;
}
checkEmail = verify.email.value;
if (checkEmail == "")
{
alert ("You did not enter an email address");
itsOkay = 0;
}
checkSrc = verify.source.value;
if (checkSrc == "")
{
alert ("You did not identify a source");
itsOkay = 0;
}
if (itsOkay)
{
investors.name_info.value = checkName;
investors.email_info.value = checkEmail;
investors.source_info.value = checkSrc;
investors.newsltr_info.value = checkNewsltr;
investors.submit();
}
}
}
//-->
</script>
<form name="verify">
Name:<input type=text name="name" size="30"><br><br>
E-Mail Address:<input type=text name="email" size="30"><br><br>
How did you find this website? <select name="source">
<option value="">list source</option>
<option value= "search engine">Search Engine</option>
<option value= "web link">Web Link</option>
<option value= "friend/family member"> Friends/Family</option>
<option value= "written publication">Written Publication</option>
<option value= "other - list below">Other List Below</option></select><br><br>
Other Source:<input type=text name="other_source" size="30"> <br><br>
Can we add you to our Newsletter?
Yes<input type="radio" name="newsltr" value="yes" checked>
No<input type="radio" name="newsltr" value="no"> <br><br></font>
<input type=button name=button Value="View Plan" onclick="checkforms()">
</form>
<form action="http://mydomain.com/cgi-bin/info.cgi" method="post" name="investors">
<input type=hidden name=name_info value="">
<input type=hidden name=email_info value="">
<input type=hidden name=source_info value="">
<input type=hidden name=newsltr_info value="">
</form>
The selected value for a group of radios can't be read directly from the name. We must look at each individual member. For groups with more element, we would normally loop through all until we find a checked radio, but here we know that if the first isn't checked, then the second one is.
checkNewsltr = verify.newsltr[0].checked? "yes":"no";