Hello
I have a textbox and a input button which will insert a mysql record, however i need to validate that textbox if its empty it shouldnt allow that button to insert any record but show a popup error.
my script :
<script Language="JavaScript">
function Blank_TextField_Validator()
{
// Check the value of the element named text_name
// from the form named text_form
if (frmContact.id.value == "")
{
// If null display and alert box
alert("Please fill in the text field.");
// Place the cursor on the field for revision
frmContact.id.focus();
// return false to stop further processing
return (false);
}
// If text_name is not null continue processing
return (true);
}
</script>
Form :
<form name="frmContact" id="frmContact" method="POST" action="index.php" onsubmit="return Blank_TextField_Validator()">
however its not validating or showing any error. any help?