I have this script that alerts when a textfield is empty
problem is the form still submits. I want to prevent it from submiting
Is there a way to stop the form from submitting?
when the textfield is empty
<script Language="JavaScript">
<!--
function Blank_TextField_Validator(form1) {
if (form1.contact.value == "")
{
alert("Please fill in the Contact field.");
//form1.contact.focus();
form1.submit();
return false;
}
return false;
}
//return (true);
//-->
</script>
<form name="form1" method="POST" action="<%=MM_editAction%>" onsubmit="return Blank_TextField_Validator(this)">
problem is the form still submits. I want to prevent it from submiting
Is there a way to stop the form from submitting?
when the textfield is empty
<script Language="JavaScript">
<!--
function Blank_TextField_Validator(form1) {
if (form1.contact.value == "")
{
alert("Please fill in the Contact field.");
//form1.contact.focus();
form1.submit();
return false;
}
return false;
}
//return (true);
//-->
</script>
<form name="form1" method="POST" action="<%=MM_editAction%>" onsubmit="return Blank_TextField_Validator(this)">