...
 
 
 

WhigWham's FREE online resources! Our WhigScript™ homepage ...

Click here to see The WhigScript™ Set do it's thing!Click here to see The WhigScript™ Set do it's thing!

A true "Do-it-all" javascript that will automatically remember ANYTHING a user enters into ANY of your form elements in a small "Cookie". It will handle all visible form elements (including radio buttons, checkboxes and select-multiple elements), multiple forms on a single page, and even includes a variety of validation functions to check any entries your user has made. Your users' entries are then automatically reloaded for them on returning to your pages.

Using this script as an external file means that you can efficiently remember all of your user's form entries throughout your entire site, from small login "username/password" forms to larger forms for registration and contact details. It is all done silently in the background!

And above all, it is easy to configure and FREE to download for personal AND commercial use (see the foot of this page for the full copyright details). Currently however, if you have more than one form on your page and you wish to have ALL of the values emailed to you, you must use our WhigMail™ add-on for this script! We hope to solve this problem in a later update, so please check back!

Follow these simple steps to utilise our WhigScript™ in your own web page(s):

WhigScript™ Setup Instructions.
Step 1: You can include the WhigScript™ into your own page directly, between the <HEAD> and <BODY> tags in your HTML page like this:


Alternatively, you can save the script as an external file by adding an external script link like this:


The latter option is recommended for 3 reasons. Firstly, this means that your user's browser only ever needs to download the approximately 7Kb script file once into its cache, and not each time your user visits another of your pages that utilises this script (every little bit helps, right?). Second, you can then place this file in a hidden directory on your web server (a basic security technique). Lastly, and most importantly, IT IS EASIER!
Step 2: Setup your form (or forms) however you like. Each form name must be unique, as the name of the first form on the page is used in naming the page cookie. You should name your form elements descriptively and uniquely, as they will be used in the in-built error reporting system shown to the web user.
Step 3: Add an "onChange" event to every form element. It should look like this in your code:


As an added feature, any default values in your forms' text or text-area elements can be cleared on entry (and restored on reset or exit) by adding this "onFocus" event:


Note that if you wish to use this feature, you MUST use the "onBlur" event handler for the saveValue function call instead! It should then look like this:


Why go to this extra trouble I hear you ask? Well, because this is a nifty little feature to cut down on your form sizes. Test it out here: (any alerts you may see are generated by our WhigScript™)

Step 4: Now for the fun part! This script includes plenty of powerful validation functions to check your user's entries before they are submitted. They are called by adding a specific "flag" to each element name like so:

Character:
Information:
* Declares the flag set, and must be included before any other flag characters.
R Flags a REQUIRED element - so you can also further validate non-required elements by omitting this flag!
E EMAIL address authenticity validator (strict check).
P Flags for the PASSWORD validator (a-z, A-Z, 0-9, "_", or "-").
N A NUMBER ONLY validator (phone numbers, age, etc.).
T The TRUE/FALSE flag - checks for "t", "f", "true", or "false" (case is ignored), and updates the field with "TRUE" or "FALSE".
Y The YES/NO flag - checks for "y", "n", "yes", or "no" (case is ignored), and updates the field with "YES" or "NO".

So examples of the basic flag set include:


Don't worry about messing up your nice, descriptive element names as the flag is removed before any errors are reported to the user!
Step 5: Now add a few generic (NOT the "reset" or "submit" types as these functions are handled by the script itself) input buttons to your form (or anywhere on the page), like so:

Step 6: If you would like, you can now change the text shown to the user on alerts, reset, load, etc. by editing the variables at the top of the script. The last thing you have to do is add the load function to the <BODY> tag of your page like so:

Step 7: All done! Just up your pages and forget about it.
Double-click to install this item directly, or right-click and select "Save As" to save to your hard-drive.
Version:
1.0
Updated:
02-Oct-01

Click here to see The WhigScript™ Set do it's thing!Click here to see The WhigScript™ Set do it's thing!

Now why not check out our additional "plug-ins" for this script:

WhigScript™ add-ons:
  WhigShop™ - the shopping cart.
  WhigCredit™ - a credit card validator.
  WhigMail™ - the email solution.
Our other scripts:
  WhigMCQ™ - a multi-choice exam tool.

The legal stuff:

 

 
Who is this guy? Find out more on our company information page...
Who is this guy? Find out more on our company information page...
 
Who is this guy? Find out more on our Company Information page...
Who is this guy? Find out more on our company information page...
Who is this guy? Find out more on our company information page...