This is once again an extremely important use of Javascript (this was one of the primary uses of Javascript). It reduces the time and resources on the server side for checking of online forms. Once again I have found many implementations of this script. This is one I find easy to understand.
<SCRIPT LANGUAGE = "JavaScript">
<!--
function isReady(recv_form) {
if (recv_form.feedback.value != "")
return true;
else {
alert("Please include a feedback message.");
recv_form.feedback.focus();
return false;
}
}
//-->
</SCRIPT>
<BODY>
<FORM NAME = "myform" onSubmit = "return isReady(this)" METHOD=POST ACTION
= "http://www.kiranpai.com/servlet1">
<TEXTAREA NAME = "feedback"></TEXTAREA><br>
<INPUT TYPE="submit" VALUE="Submit">
</FORM>
</BODY>
Comments