form on submit event : Form Submit « Form Control « JavaScript DHTML






form on submit event

   

<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
function sendMe()
{
    return confirm("Continue?");
}

function chkForm()     
{
    if (form1.textField.value == "")
    {
        alert("Please fill in the text box");
        form1.textField.focus();
        return false;
    }
}

</script>
</head>
<body>
<form name="form1" method="POST" action="youtCGI.cgi" onSubmit="return sendMe()">
<p><input type="text" name="textField">
<input type="submit" value="Submit" onClick="return chkForm()">
<input type="reset" value="Reset"></p>
</form>
</body>
</html>

   
    
    
  








Related examples in the same category

1.Form Submit action
2.Return the method used when sending form data
3.Submit a form Via Enter
4.Convert a passed form reference to a string formatted like a JavaScript array of objects
5.Use form select control to trigger the action
6.Last-Minute Checking Before Form Submission
7.Use Image to trigger submit and reset actions
8.Submit a form by sending out an email
9.Adjusting a Server Submission Action
10.Demo: Ajax form submit
11.html input mask