|
The RestrictInputTextBox is a simple control that inherits from the standard TextBox. The RestrictInputTextBox does nothing more than add an onkeypress JavaScript event handler that prevents users from typing certain characters in the TextBox. This can be useful when asking a user to enter a price without the dollar sign, a phone number using only the digits, a password that only contains certain characters, or even something as simple as making sure they only enter a number for certain fields. The Tab and Backspace keys are always allowed, so that you do not need to worry about preventing the user from editing their text or tabbing to the next field.
| ValidInput Enumeration |
Accepted Characters |
|
| ValidInput.None |
|
|
| ValidInput.AllChars |
Any Character |
|
| ValidInput.Letters |
[A-Z],[a-z] |
|
| ValidInput.AlphaNumericDigits |
[A-Z],[a-z],[0-9] |
|
| ValidInput.AlphaNumericNumbers |
[A-Z],[a-z],[0-9],.,- |
|
| ValidInput.Uppercase |
[A-Z] |
|
| ValidInput.Lowercase |
[a-z] |
|
| ValidInput.Digits |
[0-9] |
|
| ValidInput.Integers |
[0-9],- |
|
| ValidInput.Numbers |
[0-9],.,- |
|
| ValidInput.PositiveNumbers |
[0-9],. |
|
| ValidInput.Hexadecimal |
[0-9],[A-F],[a-f] |
|
| ValidInput.Binary |
[0-1] |
|
| ValidInput.Octal |
[0-7] |
|
| Server Tag |
|
| <NJS:RestrictInputTextBox runat="server" Accepted="AlphaNumericDigits" Specific="_." EnableViewState="false"/> |
|
| <NJS:RestrictInputTextBox runat="server" Accepted="AllChars" Invalid=""'" EnableViewState="false"/> |
|
| <NJS:RestrictInputTextBox runat="server" Accepted="None" Specific="AEIOUaeiou" EnableViewState="false"/> |
|
| <NJS:RestrictInputTextBox runat="server" Accepted="Hexadecimal" Specific="#" Invalid="abcdef" EnableViewState="false"/> |
|
RestrictInputTextBoxThe RestrictInputTextBox inherits all of the properties and methods in the standard TextBox, and is used to prevent the user from typing certain characters.
- Accepted - The predefined group of characters from the ValidInput enumeration (Default="AllChars")
- Specific - A String containing the characters to be added to the selected predefined group of characters (Default=String.Empty)
- Invalid - A String containing the characters to be removed from the selected predefined group of characters (Default=String.Empty)
ValidInput As ByteAn enumeration used to specify a predefined group of accepted characters.
- None - Accepts only Tab and Backspace. This option is intended to be used only if you want to completely customize the list of accepted characters
- AllChars - Accepts all characters. Intended for use when there are only a few characters you do not want to allow
- Letters - Accepts [A-Z],[a-z]
- AlphaNumericDigits - Accepts [A-Z],[a-z],[0-9]
- AlphaNumericNumbers - Accepts [A-Z],[a-z],[0-9],.,-
- Uppercase - Accepts [A-Z]
- Lowercase - Accepts [a-z]
- Digits - Accepts [0-9]
- Integers - Accepts [0-9],-
- Numbers - Accepts [0-9],.,-
- PositiveNumbers - Accepts [0-9],.
- Hexadecimal - Accepts [0-9],[A-F],[a-f]
- Binary - Accepts [0-1]
- Octal - Accepts [0-7]
|