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).

AddThis

Related podcasts

  • Episode 6: Sizzling Open FX

    I have moved to Mozilla along with my long time friend cohort and collaborator, Ben Galbraith. He joins us on this podcast, along with Alex, who joins us as a Noogler.&#10;You can download the podcast directly (OGG format too), or subscribe to the series, including via iTunes).&#10;We get back in...

Events coming up

  • Apr 8

    jQuery - An Introduction

    Edinburgh, United Kingdom

    Abstract A new client-side framework has been taking the internet by storm, many have already been mesmerised by the power of such a small javascript library. And "what is the name of this fantastic framework?" I hear you ask, "jQuery" is my reply. jQuery is a robust javascript framework with a very small footprint (15kb minified and GZipped) which makes the complicated aspects of javascript very simple. From traversing the Document Object Model to complex AJAX functionality, jQuery can do i...