These scripts all deal with Javascript forms. I'll show you some really neat forms that keep you from receiving bogus information as well as others that are just fun to play with (test personal info). As always, we're here if you have any questions or comments.
Title:Agree Before Entry Details: 1.12 KB * Uploaded October 28 1999 Description: JavaScript will only let you enter your name in this form if you indicate you agree to the terms by first clicking the I Agree radio button. If you agree, you can enter your name. But, if you disagree, you will not be able to enter or edit your name. When you disagree, the box is 'locked.' Useful if you require your visitors to accept a disclaimer before downloading software or visiting a section of your members-only site.
Title:All Lower Case Details: 0.55 KB * Uploaded August 10 1999 Description: Converts a textbox entry to all lowercase letters as soon as they move to the next item in the form (or click the submit button).
Title:All Upper Case Details: 0.55 KB * Uploaded August 9 1999 Description: Converts a textbox entry to all capital letters as soon as they move to the next item in the form (or click the submit button).
Title:Auto Month Contributor:Don Demrow (d1102@home.com) Contributor URL:http://resume.w3site.com Details: 1.74 KB * Uploaded February 5 2001 Description: This pulldown menu will automatically adjust the range of months so that the current month is at the top. The remaining months are placed in order after the current month.
Title:Auto Email Link Contributor:CodeLifter.com (support@codelifter.com) Contributor URL:http://www.codelifter.com Details: 1.69 KB * Uploaded February 21 2001 Description: Automatically opens a new e-mail using your default e-mail client and fills in the subject line and body with the address of the current web page. Neat!
Title:Auto Tab Contributor:Cyanide_7 (leo7278@hotmail.com) Contributor URL:http://www7.ewebcity.com/cyanide7 Details: 1.68 KB * Uploaded April 21 2000 Description: Automatically sets focus to the next form element when the current form element's maxlength has been reached. This way, the user does not have to manually click in or tab to the next field. This script is perfectly suited for constant-length strings such as a phone number or social security numbers. Nice!
Title:Auto Year Contributor:Don Demrow (d1102@home.com) Contributor URL:http://resume.w3site.com Details: 1.09 KB * Uploaded January 25 2001 Description: This pulldown menu will automatically adjust the range of years depending on the current year. As an added bonus, the range is easily modified. Awesome!
Title:Basic Validation Contributor: wsabstract.com Details: 1.41 KB * Uploaded April 14 1999 Description: The simplest way to require visitors to fill out certain fields is to us this script - just add the word "required" to each required field's name and your visitor must fill it out to submit the form! Neat!
Title:Block Key Press Contributor:Jeremy Wollard (wollard@flash.net) Details: 0.99 KB * Uploaded July 13 2000 Description: (Internet Explorer Only) Using the OnKeypress event, you can trap and prevent certain characters (repesented by ASCII decimal codes) from being entered in a form field. Just look up the ASCII code for any other characters you wish to block and add it to the script. Unfortunately, Netscape does not support this same functionality.
Title:Check All Contributor: Nannette Thacker Contributor URL:http://www.shiningstar.net Details: 1.39 KB * Uploaded April 28 2000 Description: Dynamically checks and unchecks all the checkboxes in a form when a button is clicked. Much easier than manually hard-coding the checkbox names, for sure.
Title:Check Entry Details: 0.95 KB * Uploaded September 8 1999 Description: Prevents the user from selecting a filename with a space (known to cause problems with some CGI-scripts). The visitor are informed that the field can not have spaces. Of course, you could change the character it checks for as well as the invalid alert message to something else to suit your needs. Nice!
Title:Checkbox Changer Details: 1.94 KB * Uploaded July 27 1999 Description: Takes a series of known named checkboxes and checks or uncheck them all at once. It can even change each checkbox to the opposite checked or not checked value. Clever for loops!
Title:Checkbox Text Contributor:trs2005@yahoo.com (trs2005@yahoo.com) Details: 0.97 KB * Uploaded July 20 2000 Description: (Internet Explorer Only) The user no longer needs to click precisely on the checkbox to check and uncheck it. Clicking the text after a checkbox can do this just like windows programs.
Title:Clean CAPS Contributor: Ronnie T. Moore, Editor Details: 1.24 KB * Uploaded August 24 2000 Description: Keep users from typing in all caps, but still allow for capital letter strings for things like initials (JPC) or uppercase abbreviations (NASA or WWII). You can easily change the number of capital letters allowed in a row after which the capital letterstring is converted to lowercase.
Title:Commas Contributor:Mark Henwood (mark_henwood@hotmail.com) Details: 1.51 KB * Uploaded January 2 2001 Description: Quickly add commas to any numerical form input. Great for displaying large numbers!
Title:Confirmable Order Form Details: 4.79 KB * Uploaded July 15 1999 Description: JavaScript can take the contents of an HTML order form, process them, and display the order for verification even including the grand total! When the user confirms the order by clicking the button, the order is emailed to you by using freedback.com's free form processor cgi script. This script does take a bit of modification, but surely is worth it if you sell anything online.
Title:Controlled Boxes Contributor: Scott Waichler Details: 1.78 KB * Uploaded June 25 1999 Description: This script allows checkboxes to check and uncheck based on the selection in another checkbox. If the ALL box is checked, all the other choices go unchecked. If another choice is checked, then the ALL box goes unchecked. Useful when constructing search forms, surveys, and more!
Title:Copy Fields Details: 8.75 KB * Uploaded November 10 1999 Description: Allows the user to click a checkbox on a form to duplicate information. For example, they can copy their billing information into the shipping information fields (assuming they are the same) with one click! Another useful timesaver for your visitors!
Title:Copy Name Details: 0.53 KB * Uploaded September 14 1999 Description: Allows the user to enter their name in the first field and have copies it to the second field for use as the User ID. It occurs instantly when they click the next field or the submit button. And, if the user tries to modify the second field, it is changed back to the value of the name field. Definitely a good example of the onChange() event handler in use.
Title:Country Chooser Details: 6.08 KB * Uploaded July 24 1998 Description: If you'd like to know where visitors to your site live, add this to your feedback forms. They just choose a region, and the second menu changes appropriately, allowing them to choose their country. (If they choose USA, it allows them to select their state) Neat!
Title:Currency Format Contributor:Cyanide_7 (leo7278@hotmail.com) Contributor URL:http://www7.ewebcity.com/cyanide7 Details: 1.47 KB * Uploaded May 18 2000 Description: This script accepts a number or string and formats it like U.S. currency. Adds the dollar sign, rounds to two places past the decimal, adds place holding zeros, and commas where appropriate. Occurs when the user clicks the button or when they finish entering the money amount (and click into the next field).
Title:Day Menu Details: 1.20 KB * Uploaded October 4 1998 Description: Do you need your visitors to select a day from this month? Here's an excellent way to do so - they get a pulldown menu containing the entire month and the current day is already selected! Cool!
Title:Decimals Allowed Contributor: Fred Serry Details: 1.42 KB * Uploaded October 26 1999 Description: Allows the user to enter a number with up to 2 decimal places in a text box. In other words, 99 is ok, 99.9 is ok, 99.99 is ok, but 99.999 is rejected. You can easily change the number of decimal places that are permitted. (i.e. 1, 2, 3, etc.) For the example, enter a number with up to 2 decimal places then try entering one with more than 2 decimal places.
Title:Disable Submit Contributor URL:http://dynamicdrive.com Details: 1.33 KB * Uploaded July 5 2000 Description: (Internet Explorer only) When the form is submitted, any submit and reset buttons are disabled. This prevents the user from submitting the form repeatedly, whether by accident or on purpose. The form will just act normally for Netscape users. Great!
Title:Dynamic Input Contributor: Peter Hermus Contributor URL:http://come.to/speedpete Details: 1.95 KB * Uploaded September 8 2000 Description: (Internet Explorer Only) Offer a form with as many input boxes that the user selects. After entering the number of boxes, the form is dynamically updated while the rest of the form remains untouched.
Title:Email Address Validation Contributor:Sandeep V. Tamhankar (stamhankar@hotmail.com) Details: 6.03 KB * Uploaded February 15 2000 Description: This is an e-mail address validation function. It allows the usual user@domain syntax, but in addition allows user@[ip] format as well as "User with Spaces"@domain or [ip], all of which are legal syntax, according to W3C. It also checks that the user hasn't done anything silly like having multiple @'s or continuous .'s in the address (e.g. jim@b@c.com and jim@c..b.co.uk).
Title:Email Domain Details: 1.12 KB * Uploaded April 21 1999 Description: Takes an email address and returns just the domain - the stuff after the "@" sign. We've put it together with a simple WHOIS query, neat!
Title:Encode Special Characters Details: 1.10 KB * Uploaded August 6 1999 Description: When submitting the form "GET" method, JavaScript can encode special characters with the escape() function. Great! (Enter a nickname or password with some special variables then click 'submit' to see the web address which contains the encoded (%xx) characters.)
Title:Exit Window Details: 0.64 KB * Uploaded May 15 1998 Description: When a visitor leaves your page, JavaScript can automatically open a new window. Use it to say "thanks for visiting", etc. Very neat! Check it out!
Title:External JS Contributor:Jacob Hage (jacob@hage.dk) Contributor URL:http://www.hagedesign.dk Details: 6.75 KB * Uploaded August 23 2000 Description: Using an external JavaScript file, simply define the rules for how each field should be validated and you're set. Piece of cake! And since it is it's own .js file, it's easy to use the code on every page of your site. Currently only validates text, numbers and e-mail addresses.
Title:Extract Email Addresses Contributor: Ronnie T. Moore, Editor Details: 1.19 KB * Uploaded September 1 2000 Description: Visitors sometimes include their email address inside the message field when they fill out forms. To deal with this, this script parses through the string and uses a Regular Expression to find then return a comma-separated list of the valid email addresses it finds. Easy!
Title:Field Explanation Details: 2.29 KB * Uploaded January 11 2000 Description: Opens an explanation window to explain the various fields used in a form on your site when the help link is clicked. You can easily explain various form fields will be used on your site, what type of input is required, or any other information you wish to share. They may also type their entry in the popup window and it will be copied into the form. Great!
Title:Form Focus Contributor:Tom Khoury (twaks@yahoo.com) Details: 1.15 KB * Uploaded October 12 2000 Description: Places the focus on the first editable field in a form on any web page. Efficient!
Title:Format Input Contributor:Phillip Bryant (toxic1@fcmail.com) Contributor URL:http://fly.to/toxic Details: 2.99 KB * Uploaded December 29 2000 Description: Format the text case inside a form, reverse the text, or see the ASCII code behind the input. Cool!
Title:Form Target Formatting Contributor:Cyanide_7 (leo7278@hotmail.com) Contributor URL:http://www7.ewebcity.com/cyanide7 Details: 2.27 KB * Uploaded April 11 2000 Description: Allows you to format the target window of a form from the form's target property. This allows for the use of window properties, variables, and other data manipulation to effect these options. Great!
Title:Form Totals Contributor:Paul DeBrino (irandd@aol.com) Details: 2.56 KB * Uploaded October 10 2000 Description: Presents an order form with checkboxes and upates the total price as the user checks and unchecks boxes. The visitor also cannot change the total field. Currently only supports selecting one of each item. More JavaScript forms available at http://members.aol.com/irandd/.
Title:Format Date Contributor:Richard Gorremans (RichardG@spiritwolfx.com) Contributor URL:http://www.spiritwolfx.com/ Details: 14.29 KB * Uploaded February 14 2001 Description: Automatically formats date fields as the user enters the information. Also validates the date when complete date has been entered. Cross browser compatible, including Netscape 6+. Great!
Title:Initial Caps Contributor:William Humphreys (billy@technical-solutions.co.uk) Details: 1.54 KB * Uploaded January 4 2000 Description: Converts the first letter of each word in a string that the user enters to uppercase. The remaining letters of each word are also changed to lowercase. Very useful when a form requires a title to be submitted in Initial Caps.
Title:Items List Details: 1.30 KB * Uploaded August 4 1997 Description: Javascript can remember a list of several items you enter. Just enter an item and click 'Add to List'. When you are finished, click 'Show List' to see the entries.
Title:Items Popup List Contributor:Pankaj Mittal (pankajm@writeme.com) Contributor URL:http://www.fortunecity.com/lavendar/lavender/21 Details: 5.27 KB * Uploaded May 10 2000 Description: If you have several items for the user to pick from, you may notice that your page can quickly becomes cluttered. This script helps solve that problem by opening a new window when the user wants to add items to the list. The new window displays the items and passes the selected item information back to the list in the main window. Slick!
Title:Limit Textarea Contributor: Ronnie T. Moore, Editor Contributor URL:JavaScript Source Code 2002 Details: 1.37 KB * Uploaded May 22 2000 Description: This script controls a maximum textarea input amount and updates a small counter with how many characters are left with each keystroke. Dynamic fix now allows you to use this script in multiple textboxes on a page. Easy!
Title:Locked Textbox Details: 0.46 KB * Uploaded March 21 1999 Description: Prevent your visitors from modifying the value stored in a textbox (without using input type=hidden) Just try to change the text in the box! Amazingly, it's a short less than one line script!
Title:Limit Boxes Contributor:Glenn Wang (brief@ix.netcom.com) Contributor URL:http://capsule.bayside.net/ Details: 1.56 KB * Uploaded January 28 2000 Description: Limits the number of checkboxes that the user is able to check on your site. Ideal for situations when more than one selection is allowed up to a certain number overall. If they select too many, they are notified of the maximum allowed and their last entry becomes unchecked.
Title:Line Wrapper Details: 2.35 KB * Uploaded September 30 1999 Description: Wraps entries in a textarea box to whatever number of characters per line you want. For example, The script can automatically insert a return after each 50 spaces, so that the form contents you receive are more readable. (The script does indifferently break lines in mid-word, a possible fix for the next version?)
Title:List Chooser Contributor:Anand Raman (anand_raman@poboxes.com) Contributor URL:http://www.angelfire.com/ar/diduknow Details: 4.83 KB * Uploaded October 18 1999 Description: The user can immediately locate what he has been searching for in the long options list just by typing. With each character the user types in the text field, the available items listed are narrowed down (similar to a help file's index feature). Clever! (Start by entering an 'a' to narrow the list)
Title:Mail - Pick Subject Details: 4.15 KB * Uploaded July 11 1997 Description: Use Javascript to help organize your visitor e-mail. Visitors pick from several predetermined subjects the most appropriate subject for their e-mail. Visitor are also prompted to reenter information for incomplete or invalid entries. A cookie also records the visitor's name for future e-mails.
Title:Mailing List Details: 4.56 KB * Uploaded July 11 1997 Description: Use Javascript to sign up visitors for your mailing list. Once again, Javascript ensures that the visitors have filled out the form completely and correctly. Visitors area also prompted to reenter any incomplete or invalid entries.
Title:Max Entry Details: 1.00 KB * Uploaded March 31 1999 Description: Make sure your visitor doesn't exceed the maximum number of characters that you want to accept in a form. Short too!
Title:Money Filter Contributor:Fred Roberts (fred@gloryofgod.com) Details: 0.89 KB * Uploaded March 10 2000 Description: Removes the dollar sign ($) and commas (,) from a a text box. Useful if you require input of only numbers. You may also modify the script to filter out whatever characters you want.
Title:Multiple Mailer Contributor: Jeff Kieke Details: 1.78 KB * Uploaded July 3 1998 Description: JavaScript can help you send an e-mail to anyone on your "list". Just use the pulldown menu to select a recipient, compose your message, and hit 'Send Message' to send it. This too, is another good JavaScript example for all beginners to learn from.
Title:Menu Swapper Contributor:Ilya Fedotov (ifedotov@yahoo.com) Details: 2.52 KB * Uploaded May 7 1999 Description: A clever way to move selected items from one list box to another using "<<" and ">>" direction buttons. It works like database field selection, supports selecting multiple items, and even can sort the moved item into the new list!
Title:New Window Details: 0.96 KB * Uploaded May 15 1998 Description: Do you have a link that you'd rather have open in a new window? This little script will do just that! You can even use a button or a text link to open the new window! Check out the example and see what you think!
Title:Only One Field Details: 1.45 KB * Uploaded July 30 1999 Description: The visitor must fill in either one of two fields, their name or email address. If they click in either box the other box's value is erased. Ensures that when the form is submitted only one field contains a value. Also contains validation that makes sure both fields are not empty.
Title:Option Search Contributor:Darko Egersdorfer (darkoe@za.bynx.com) Details: 1.90 KB * Uploaded October 24 2000 Description: Allows you to jump to any value in a drop down list. In our example, search for a value between 'a1' and 'a15'. Saves time when it comes to navigating within long pull down menus.
Title:Pass Menu (in frames) Contributor: Ronnie T. Moore, Editor Contributor URL:JavaScript Source Code 2002 Details: 1.42 KB * Uploaded March 27 2000 Description: After the user selects an option in the pulldown menu in the left frame, JavaScript can pass that option's value into a text box in the right frame when the button is clicked. Cool!
Title:Pass Textbox (in frames) Contributor: Ronnie T. Moore, Editor Contributor URL:JavaScript Source Code 2002 Details: 1.38 KB * Uploaded March 24 2000 Description: Copies the text in a box in the left frame into a box in the right frame when the button is clicked. A clever way to pass values in frames.
Title:Passing Values Details: 1.23 KB * Uploaded November 11 1999 Description: Here is a clever way of 'unwrapping' the contents of a form when passed from one page to the next. This capability would be useful in many situations, such as passing the contents of a form to another page, retaining information about the current page for the rest of their visit, etc. Great!
Title:Password Verifier Contributor:Carey Walker (carey.walker@citicorp.com) Details: 1.13 KB * Uploaded April 18 1999 Description: Keep your visitors from submitting their form until their "password" and "re-enter password" fields match, for verification purposes. They get an error message telling them to re-enter the passwords if they do not match.
Title:Popup Picker Contributor:Shawn A. Mann (dharmamann@hotmail.com) Contributor URL:http://www.laughingshaman.com Details: 2.14 KB * Uploaded October 25 2000 Description: Select an item from the list and the selected value is passed to the form field of the original window, and the pop-up closes automatically. Useful!
Title:Quantity Totals Contributor:Paul DeBrino (irandd@aol.com) Details: 3.96 KB * Uploaded November 30 2000 Description: (Best with Internet Explorer) Update to our Form Totals Script. Allows you to enter a quantity of each item selected and finds the total automatically. More JavaScript forms available at http://members.aol.com/irandd/. Great!
Title:Remove Returns Contributor:Ascii King (chicorama@usa.net) Contributor URL:http://www.geocities.com/enchantedforest/2120 Details: 1.41 KB * Uploaded June 20 2000 Description: Converts carriage returns in a string to the tag so that the input can be properly displayed in HTML. Without the script, returns in an input field are not preserved when submitting in a form. Useful for guestbooks or other times when a user's input must be preserved.
Title:Replace Characters Details: 1.09 KB * Uploaded August 16 1999 Description: Replaces a character or multiple characters in a textbox when the visitor goes to the next field (or in this example, clicks the submit button).
Title:Search Box Contributor:blakethedog@woh.rr.com (blakethedog@woh.rr.com) Details: 2.49 KB * Uploaded February 15 2001 Description: This JavaScript search form opens a seperate window where you can select from search engines such as Yahoo!, Excite, and more. Awesome!
Title:Select All Details: 0.52 KB * Uploaded February 28 2001 Description: Select the text from any form with the click of a button, just as used on the JavaScript Source. Easy!
Title:Selection Box Contributor:Kathi O'Shea (Kathi.O'Shea@internet.com) Contributor URL:http://www.web-savant.com/users/kathi/asp Details: 3.29 KB * Uploaded October 19 2000 Description: Copy items from one selection box to a second selection box. Selected item values are stored as a string for further manipulation, such as submitted through a form, an alert box, etc. Useful!
Title:Sentence Caps Details: 2.10 KB * Uploaded July 11 1997 Description: Use Javascript to convert entries to sentence caps. Also, this script prevents jokers from typing in all caps.
Title:Smut Engine Details: 1.31 KB * Uploaded July 11 1997 Description: Use Javascript to ensure that forms submissions to do not contain words you don't want. It can eliminate dirty words or competitors' names.
Title:Strip Characters Contributor:Ryan A. Somma (ryan@waygate.com) Contributor URL:http://www.waygate.com Details: 1.45 KB * Uploaded October 11 2000 Description: Strips the characters from an input string. You can change the characters you want removed from the string by changing one line of code. Very useful!
Title:Submit Changer Contributor: Mike Fernandez Details: 0.87 KB * Uploaded July 19 2000 Description: Changes the caption of the form's submit button while the form is being submitted. This helps eliminate the confusion that can sometimes occur when a form takes quite a while to be processed by the server.