shdwdrgn000
MIS
I have fallen into a situation with a form on our website. The form functions perfectly in IE, but the same exact page does not work in Netscape. The validation refuses to work on the radio buttons at the bottom of the form. Below I have attached exerpts from the js code, and the html form code. The validation gets caught in the radio buttons, it will not let you pass, if it you click any of the buttons at all, or leave it empty. The js script is called in the <head> of the document with the line of code
<SCRIPT LANGUAGE="javascript" SRC="scripts/usbuildings_new.js"></SCRIPT>
Any help you can give me would be great.
----js code (exerpt)------------
// Publication validation
//
if (the_form.has_value.value == '0')
{
alert('Please select how you heard about us');
return (false);
}
if (document.all.publication_1.checked)
{
if (the_form.adv_magazine.value == '') {
alert('Please enter the name of the magazine.');
return(false);
}
}
else if (document.all.publication_2.checked)
{
if (the_form.adv_promotional.value == '') {
alert('Please enter your special promotion code listed in the middle or bottom right hand side of your ad.');
return(false);
}
}
return (true);
}
//
// Publication type events
//
function publication_event()
{
if (document.all.publication_1.checked)
{
document.all.adv_1.style.visibility = 'visible';
document.all.adv_2.style.visibility = 'hidden';
document.all.adv_magazine.focus();
}
else if (document.all.publication_2.checked)
{
document.all.adv_1.style.visibility = 'hidden';
document.all.adv_2.style.visibility = 'visible';
document.all.adv_promotional.focus();
}
else
{
document.all.adv_1.style.visibility = 'hidden';
document.all.adv_2.style.visibility = 'hidden';
}
document.all.has_value.value = '1';
}
----HTML Form Code (excerpt)--------------
<tr class='formrow'>
<td class='tdformtextreq' colspan="5">
*HOW DID YOU HEAR ABOUT US?
</td>
</tr>
<tr>
<td colspan="5">
<input type="hidden" id="has_value" value="0"/>
</td>
</tr>
<tr class='formrow'>
<td align="right" colspan="2">
<div id="adv_1" style="visibility: Hidden">
<strong>Magazine Name :</strong>
<input type="text" size="25" style="width: 200px" name="publication_descrip" id="adv_magazine"/>
</div>
</td>
<td colspan="3">
<INPUT TYPE="radio" VALUE="1" NAME="publication_id" ID="publication_1" onclick="publication_event();">
<strong>Magazine Ad</strong>
</td>
</tr>
<tr class='formrow'>
<td align="right" colspan="2">
<div id="adv_2" style="visibility: hidden">
<strong>Enter code for special savings:</strong>
<input type="text" size="25" style="width: 200px" name="publication_descrip" id="adv_promotional"/>
</div>
</td>
<td colspan="3">
<INPUT TYPE="radio" VALUE="2" NAME="publication_id" ID="publication_2" onclick="publication_event();">
<strong>Promotional Ad</strong>
</td>
</tr>
<tr class='formrow'>
<td colspan="2"> </td>
<td colspan="3">
<INPUT TYPE="radio" VALUE="3" NAME="publication_id" ID="publication3" onclick="publication_event();">
<strong>TV Commercial</strong>
</td>
</tr>
<tr class='formrow'>
<td colspan="2"> </td>
<td colspan="3">
<INPUT TYPE="radio" VALUE="4" NAME="publication_id" ID="publication4" onclick="publication_event();">
<strong>Search Engine</strong>
</td>
</tr>
<tr class='formrow'>
<td colspan="2"> </td>
<td colspan="3">
<INPUT TYPE="radio" VALUE="5" NAME="publication_id" ID="publication5" onclick="publication_event();">
<strong>Banner Ad</strong>
</td>
</tr>
<tr class='formrow'>
<td colspan="2"> </td>
<td colspan="3">
<INPUT TYPE="radio" VALUE="6" NAME="publication_id" ID="publication6" onclick="publication_event();">
<strong>Friend or Relative</strong>
</td>
</tr><tr class='formrow'>
<td colspan="5" align=center>
<br><br>
Would You Like To
</td>
</tr>
<tr class='formrow'>
<td colspan="5" align="center">
<select name="contact_status" id="contact_status" >
<OPTION VALUE="download" selected>Download Brochure</OPTION>
<OPTION VALUE="mail">Have Brochure Mailed</OPTION> </select>
</td>
</tr>
<tr class='formrow'>
<td colspan="5"> </td>
</tr>
<tr class='formrow'>
<td colspan="5" align="center">
<input class="forminput" type="submit" value="Please Submit" size="25" style="width: 150px"/>
<INPUT class="forminput" TYPE="reset" VALUE="Cancel" NAME="reset">
</td>
</tr>
</table>
</form>
<SCRIPT LANGUAGE="javascript" SRC="scripts/usbuildings_new.js"></SCRIPT>
Any help you can give me would be great.
----js code (exerpt)------------
// Publication validation
//
if (the_form.has_value.value == '0')
{
alert('Please select how you heard about us');
return (false);
}
if (document.all.publication_1.checked)
{
if (the_form.adv_magazine.value == '') {
alert('Please enter the name of the magazine.');
return(false);
}
}
else if (document.all.publication_2.checked)
{
if (the_form.adv_promotional.value == '') {
alert('Please enter your special promotion code listed in the middle or bottom right hand side of your ad.');
return(false);
}
}
return (true);
}
//
// Publication type events
//
function publication_event()
{
if (document.all.publication_1.checked)
{
document.all.adv_1.style.visibility = 'visible';
document.all.adv_2.style.visibility = 'hidden';
document.all.adv_magazine.focus();
}
else if (document.all.publication_2.checked)
{
document.all.adv_1.style.visibility = 'hidden';
document.all.adv_2.style.visibility = 'visible';
document.all.adv_promotional.focus();
}
else
{
document.all.adv_1.style.visibility = 'hidden';
document.all.adv_2.style.visibility = 'hidden';
}
document.all.has_value.value = '1';
}
----HTML Form Code (excerpt)--------------
<tr class='formrow'>
<td class='tdformtextreq' colspan="5">
*HOW DID YOU HEAR ABOUT US?
</td>
</tr>
<tr>
<td colspan="5">
<input type="hidden" id="has_value" value="0"/>
</td>
</tr>
<tr class='formrow'>
<td align="right" colspan="2">
<div id="adv_1" style="visibility: Hidden">
<strong>Magazine Name :</strong>
<input type="text" size="25" style="width: 200px" name="publication_descrip" id="adv_magazine"/>
</div>
</td>
<td colspan="3">
<INPUT TYPE="radio" VALUE="1" NAME="publication_id" ID="publication_1" onclick="publication_event();">
<strong>Magazine Ad</strong>
</td>
</tr>
<tr class='formrow'>
<td align="right" colspan="2">
<div id="adv_2" style="visibility: hidden">
<strong>Enter code for special savings:</strong>
<input type="text" size="25" style="width: 200px" name="publication_descrip" id="adv_promotional"/>
</div>
</td>
<td colspan="3">
<INPUT TYPE="radio" VALUE="2" NAME="publication_id" ID="publication_2" onclick="publication_event();">
<strong>Promotional Ad</strong>
</td>
</tr>
<tr class='formrow'>
<td colspan="2"> </td>
<td colspan="3">
<INPUT TYPE="radio" VALUE="3" NAME="publication_id" ID="publication3" onclick="publication_event();">
<strong>TV Commercial</strong>
</td>
</tr>
<tr class='formrow'>
<td colspan="2"> </td>
<td colspan="3">
<INPUT TYPE="radio" VALUE="4" NAME="publication_id" ID="publication4" onclick="publication_event();">
<strong>Search Engine</strong>
</td>
</tr>
<tr class='formrow'>
<td colspan="2"> </td>
<td colspan="3">
<INPUT TYPE="radio" VALUE="5" NAME="publication_id" ID="publication5" onclick="publication_event();">
<strong>Banner Ad</strong>
</td>
</tr>
<tr class='formrow'>
<td colspan="2"> </td>
<td colspan="3">
<INPUT TYPE="radio" VALUE="6" NAME="publication_id" ID="publication6" onclick="publication_event();">
<strong>Friend or Relative</strong>
</td>
</tr><tr class='formrow'>
<td colspan="5" align=center>
<br><br>
Would You Like To
</td>
</tr>
<tr class='formrow'>
<td colspan="5" align="center">
<select name="contact_status" id="contact_status" >
<OPTION VALUE="download" selected>Download Brochure</OPTION>
<OPTION VALUE="mail">Have Brochure Mailed</OPTION> </select>
</td>
</tr>
<tr class='formrow'>
<td colspan="5"> </td>
</tr>
<tr class='formrow'>
<td colspan="5" align="center">
<input class="forminput" type="submit" value="Please Submit" size="25" style="width: 150px"/>
<INPUT class="forminput" TYPE="reset" VALUE="Cancel" NAME="reset">
</td>
</tr>
</table>
</form>