Today is . Page created 11/24/06, updated 11/25/06

Stop Limit Characters And Words Entered Forms


characters typed
characters left
words typed
words left

This script will allow you to limit the number of words and/or characters entered into a form.

We have tested the code in IE7, Firefox1.5.0.7, Opera9.02, Netscape8.1 and AOL Explorer1.2. This script worked well in all platforms with no variations observed.

For Your Information For your Information:     Before we begin, we feel obligated to advise you that the above form is for all intensive purposes a "Stand Alone" script. In other words, it really does not do much of anything other than what you see. In order to make it function as designed, you need to incorporate it into a valid working form. If you do not have a good Solid Knowledge of HTML coding, javascripts, forms and reconfigurations, please "Do Not Attempt" this until you are Proficient in the aforementioned areas.

Warning Logo     Note Of Importance     Before we begin, you need to be made aware there is an error in the copy and paste code you get from the script site(it can be rectified very easily). In the section of code you will be making into an external file (charLeft.js), there is a part of the code that is missing and if you copy, paste and upload as an external .js file, you will receive an error on the page the effect is located. To rectify the problem, see the below examples:

Incorrect Code

/* For additional information about this JavaScript
and how to use it, see the "Displaying Number of Words
Typed Into Form Fields" article, linked from the archives
at from http://willmaster.com/possibilities/archives/
The above note and the copyright line must remain with
this JavaScript source code. Comments below this point
in the code may be removed if desired.

// Customizing this JavaScript code requires specifying eight values.

Correct Code

/* For additional information about this JavaScript
and how to use it, see the "Displaying Number of Words
Typed Into Form Fields" article, linked from the archives
at from http://willmaster.com/possibilities/archives/
The above note and the copyright line must remain with
this JavaScript source code. Comments below this point
in the code may be removed if desired.*/

// Customizing this JavaScript code requires specifying eight values.

If you have noticed in the above, all we did was to add the closing comment tag */ at the correct place within the code. If you understand JavaScripting, the opening /* and closing */ tags are for all intensive purposes used to enclose blocks of comments. They including the comments between the opening and closing tags. In other words:

To comment out an entire block, place a forward slash followed by an asterisk at the beginning of the block, and the same characters in opposite order at the end of the block.
/* here is my
entire comment
block */

The site where you get the code has been notified of this error as of 11/24/06.

Now that we have resolved that little inconsistency within the code, lets move on.

  1. Copy and paste the section of code into a notepad (be sure you have the correction added into this part of the code), save it as charLeft.js, and upload it into your directory.
  2. Add a snipplet of code into the <HEAD> section of the document to call the external .js file.
  3. Incorporate the <BODY> section of code into a working form.

Depending on your knowledge of HTML and javascripts, this is an easy two (2) part copy and paste code that goes in both the <HEAD> and <BODY> sections (incorporated into a working form) of your document. It also makes use of an external .js script you need to save and upload into your directory then add a snipplet of code into the <HEAD> section to call the external.js file.

Warning Logo     Note Of Importance:     If you are not sure of howto make the external .js file and make use of it within your document, grab the below link and it is fully explained.
.js File Howto ]

For Your Information For your Information:     If you are not comfortable or prefer not to use the external.js file, you can use the traditional cut/copy and paste instead of the external .js file. If you need a little refresher on what is required to achieve this, grab the below link and it is fully explained.
Traditional Cut/Copy and Paste ]

Depending on which of the above methods you have selected (external.js file or Traditional Copy/Cut & Paste), you will add either the snipplet of code (after you have uploaded the external.js file) into the <HEAD> section or the completed section of code that you added the opening and closing script tags.

Snipplet Of Code

<script type="text/javascript" src="charLeft.js">
</script>
Traditional Copy/Cut and Paste

<SCRIPT LANGUAGE="JavaScript">

<HEAD> Section of code goes here

//  End -->
</script>

Arrow External .js file



Arrow Traditional Copy/Cut & Paste Code with opening & closing tags that you had to add into the <HEAD> section of code that was originally earmarked to be an external .js file.

If you would like to see an example of this effect using the "Traditional Cut/Copy & Paste" method, grab the below link and you are there. Examine our "Source" code (on the page you will be opening) to see how we had to reconfigure it to make it work. We have it very well documented for your convenience.
Traditional Cut/Copy & Paste Method ]

On A Final Note     The reconfigurations that can be made to change the number of words, characters etc. are all located within the charLeft.js file you uploaded. They are pretty straight forward and self-explained. If you need a full tutorial on this, contact us and we will be more that glad to make one.

W e hope our tutorial was easy to follow and we covered everything in detail. If you would like to add this effect into your pages, grab the respective below link and you are there. If you have any problems with this or anything else, feel free to consult our FAQ ] and if you can't find the answer there, contact us ].
Get Code Here ]   [ Rate This Page ]