/*
Javascript Essentials
by Jason J. Manger
Publisher: Mcgraw-Hill Osborne Media;
ISBN: 0078822343
*/
<!--
Program 5-9
Author Note:
The host www.somehost.com is hypothetical in this example. The
process_form.pl file should reside on a host that supports the
Perl language. See the file process_form.pl for the scripts
source code.
-->
<html>
<head>
<script language="JavaScript">
<!--
function validateForm(f) {
if (f.value == "") {
alert("Please enter some text into the " +
"feedback field");
return false;
}
else
// Ok, let the form submit the data:
return true;
}
//-->
</script>
</head>
<body>
<pre>
<form name="myForm"
method="post"
action="http://www.somehost.com/cgi-bin/process_form.pl"
onSubmit="validateForm(myForm.feedback)">
Full Name: <input type="text" size=30 name="persons_name"><br>
Feedback : <textarea name="feedback" rows=5
cols=50></textarea><p>
<input type="submit" value="Send Data">
</form>
</pre>
</body>
</html>
|