hyefive
10-30-2002, 02:17 AM
Hello codingforums,
I'm trying to use the following script to intercept a PROP_TYPE = "RES" form submission that doesn't include a PROP_SUB_T value. Can't figure out why I'm not getting the alert box when testing it...
<head>
<script language="javascript">
function checkForms(){
if (document.form1.PROP_TYPE.value == "RES" && document.form1.PROP_SUB_T.value == ""){
alert("Please choose a Property Type")
return false;
}
}
</script>
</head>
<body>
<table>
<form action="search.asp" method="post" onsubmit="return checkForms()" id="form1" name="form1">
<tr>
<td><input type="RADIO" name="PROP_TYPE" value="RES" onClick="opens_only_res_on();">Residential
<br><input type="RADIO" name="PROP_TYPE" value="INC" onClick="opens_only_inc_on();">Multi-Residential Income</td></tr>
<% If PROP_TYPE = "RES" Then %>
<tr>
<td><input type="checkbox" name="PROP_SUB_T" value="SFR">SFR <input type="checkbox" name="PROP_SUB_T" value="CND">COND</td></tr>
<% End If %>
<tr>
<td><input type="SUBMIT" value="Search"></td></tr>
</table>
</form>
</body>
I tried it without the onClick handler, and it made no difference but I've left it in anyways to give a clearer picture...
Thank you for any help you can provide!
I'm trying to use the following script to intercept a PROP_TYPE = "RES" form submission that doesn't include a PROP_SUB_T value. Can't figure out why I'm not getting the alert box when testing it...
<head>
<script language="javascript">
function checkForms(){
if (document.form1.PROP_TYPE.value == "RES" && document.form1.PROP_SUB_T.value == ""){
alert("Please choose a Property Type")
return false;
}
}
</script>
</head>
<body>
<table>
<form action="search.asp" method="post" onsubmit="return checkForms()" id="form1" name="form1">
<tr>
<td><input type="RADIO" name="PROP_TYPE" value="RES" onClick="opens_only_res_on();">Residential
<br><input type="RADIO" name="PROP_TYPE" value="INC" onClick="opens_only_inc_on();">Multi-Residential Income</td></tr>
<% If PROP_TYPE = "RES" Then %>
<tr>
<td><input type="checkbox" name="PROP_SUB_T" value="SFR">SFR <input type="checkbox" name="PROP_SUB_T" value="CND">COND</td></tr>
<% End If %>
<tr>
<td><input type="SUBMIT" value="Search"></td></tr>
</table>
</form>
</body>
I tried it without the onClick handler, and it made no difference but I've left it in anyways to give a clearer picture...
Thank you for any help you can provide!