Library code snippets

Validating the form contents

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

  1. 01 Jan 1999 at 00:00

    This thread is for discussions of Validating the form contents.

Leave a comment

Sign in or Join us (it's free).

Kiran Pai
AddThis

Related podcasts

  • jQuery in ASP.NET

    In this episode Chris Brandsma, Rick Strahl, Dave Ward, Bertrand Le Roy, Scott Koon, and Steven Harman discuss Microsoft's jQuery in ASP.NET announcement.This episode of the Alt.NET Podcast is brought to you by LLBLGen Pro, the most mature O/R mapper and code generator out there.Are you loo...

Events coming up

Want to stay in touch with what's going on? Follow us on twitter!