Is it possible to restrict a .php file to process after 'Submit' if one or more text boxes becomes empty using JavaScript ? Please show me the one.
Printable View
Is it possible to restrict a .php file to process after 'Submit' if one or more text boxes becomes empty using JavaScript ? Please show me the one.
Can you rephrase that question?
Is this what you want?
This won't submit the form until a value has been entered.
HTML Code:<script language="javascript">
function validate(theform) {
if (theform.YourField.value=="") {
alert("Pleaes enter a value");
theform.YourField.focus()
return false; }
}
</script>
PHP Code:<form method="post" action="YourPage.php" onSubmit="return validate(this)">
<input type="text" name="YourField">
<input type="submit" name="submit" value="Submit">
</form>