Form Controls
Add these controls to your page using form fields and Javascript together.
Modern Combo Box
One form field HTML doesn't provide is the combo box. The only way you used to be able to create one was using two separate fields (one for text input and one for the select). Now with a little JavaScript we can add all the combo boxes into our form that we want and have them as text inputs for those without JavaScript.
One form field HTML doesn't provide is the combo box. The only way you used to be able to create one was using two separate fields (one for text input and one for the select). Now with a little JavaScript we can add all the combo boxes into our form that we want and have them as text inputs for those without JavaScript.
First Focus
Allow your visitors to start typing into a form on your page straight away by giving the first input field the focus.
Allow your visitors to start typing into a form on your page straight away by giving the first input field the focus.
Disable Form Fields
Modern browsers allow you to display a form field that is "disabled" so that it can't be accessed. You can use Javascript to enable the field once the appropriate entries in other form fields have been made.
Modern browsers allow you to display a form field that is "disabled" so that it can't be accessed. You can use Javascript to enable the field once the appropriate entries in other form fields have been made.
Limiting Selections
Grouping checkboxes and limiting the number of entries selected in each group using Javascript.
Grouping checkboxes and limiting the number of entries selected in each group using Javascript.
Regular Expressions
A regular expression is a pattern that uses a special syntax to describe the content of a text field. It can be used either to validate that the string contains a valid value or alternatively it can be used to format a value entered so that it matches the specified format.
A regular expression is a pattern that uses a special syntax to describe the content of a text field. It can be used either to validate that the string contains a valid value or alternatively it can be used to format a value entered so that it matches the specified format.
Linked Dropdowns
If you have two dropdown lists in your form where selecting certain values in one list require that the same value be selected in the second list then this simple Javascript will link them for you.
If you have two dropdown lists in your form where selecting certain values in one list require that the same value be selected in the second list then this simple Javascript will link them for you.
Dynamic Dropdowns - Two Selects
There will be times when the entries you want are dependent on some other selection that has already been made. Here's how to populate one drop down selection list based on the entry selected in a second selection liat.
There will be times when the entries you want are dependent on some other selection that has already been made. Here's how to populate one drop down selection list based on the entry selected in a second selection liat.
Highlighting Text
Highlighting the current text in a form field when that field gets the focus makes it easier for your visitors to replace your default entry with their text.
Highlighting the current text in a form field when that field gets the focus makes it easier for your visitors to replace your default entry with their text.
Convert to Roman Numerals
You can easily convert any number between 1 and 3999 into roman numerals using this simple function.
You can easily convert any number between 1 and 3999 into roman numerals using this simple function.
Counting Words
Have you ever thought that it would be useful to be able to count the number of words that have been typed into a text field or text area. Well here's a script that dynamically keeps track of how many words have been entered.
Have you ever thought that it would be useful to be able to count the number of words that have been typed into a text field or text area. Well here's a script that dynamically keeps track of how many words have been entered.
Passing the Referrer in a Form
Want to know where your visitor came from before they got to the page with your form. Why not add a hidden field to the form to pass the document.referrer.
Want to know where your visitor came from before they got to the page with your form. Why not add a hidden field to the form to pass the document.referrer.
Upper and Lowercase Conversion
Convert what your visitors enter into all uppercase or all lowercase. We can even arrange to just capitalize the first letter of each word with a little more work.
Convert what your visitors enter into all uppercase or all lowercase. We can even arrange to just capitalize the first letter of each word with a little more work.
One Form Field with Multiple Values
Sometimes you need form fields where you want to have more than one value in the same field at the same time. This applies particularly to radio buttons and selection lists where you predefine the value(s) that you want each option to have. Some simple Javascript coding will allow you to assign as many values as you want to one form field at the same time.
Sometimes you need form fields where you want to have more than one value in the same field at the same time. This applies particularly to radio buttons and selection lists where you predefine the value(s) that you want each option to have. Some simple Javascript coding will allow you to assign as many values as you want to one form field at the same time.
Date Selector
Make it easy for your visitors to enter dates into text fields by displaying a calendar for them to select from.
Make it easy for your visitors to enter dates into text fields by displaying a calendar for them to select from.
Accumulating Data Before Submitting
How to accumulate data into a textarea before submitting your form.
How to accumulate data into a textarea before submitting your form.
Limiting Textarea Text
Restricting how much text can be entered into a textarea.
Restricting how much text can be entered into a textarea.
Counting With Buttons
Build your own count field using plus and minus buttons to change the count. There are two ways to do it, one using an input field to store the count and the second using plain text.
Build your own count field using plus and minus buttons to change the count. There are two ways to do it, one using an input field to store the count and the second using plain text.
Selecting Today's Date
One way of getting your visitors to enter dates is via drop down lists. This script allows you to automatically set the default options selected to today's date.
One way of getting your visitors to enter dates is via drop down lists. This script allows you to automatically set the default options selected to today's date.
