Return false in form button click event : submit button : Form JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Form » submit button »

 

Return false in form button click event

















<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
<!--

function chkForm()
{
    if (form1.inp1.value == "")
    {
        alert("Please fill in the text box");
        form1.inp1.focus();
        return false;
    }
}
//  -->
</script>
</head>
<body>
<form name="form1" method="POST" action="">
<P><input type="text" name="inp1">
<input type="submit" value="Submit" onClick="return chkForm()">
<input type="reset" value="Reset"></p>
</form>
</body>
</html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Form
» submit button