INPUT TAG |
INPUT TAG |
Haider |
Oct 9 2018, 11:18 PM
Post
#1
|
Group: Members Posts: 2 Joined: 9-October 18 Member No.: 26,728 |
can any one help me to add a text box only for alphabates.
|
pandy |
Oct 10 2018, 12:07 AM
Post
#2
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
Say what?
|
Haider |
Oct 10 2018, 12:15 AM
Post
#3
|
Group: Members Posts: 2 Joined: 9-October 18 Member No.: 26,728 |
|
Christian J |
Oct 10 2018, 06:14 AM
Post
#4
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
You might use the PATTERN attribute together with a regular expression:
CODE <input type="text" name="foo" pattern="[A-Za-z]"> The PATTERN attribute only works for client-side form validation, which can be circumvented by users, so you need to sanitize the form data in the server-side script as well. Note that the above regular expression is just a simple example, and will only work for the latin alphabet. Other alphabets (even characters with diacritical marks, like é) may be blocked, as well as spaces, hyphens and punctuation. There are probably better regex patterns you can use, but this is a tricky subject. |
Lo-Fi Version | Time is now: 26th April 2024 - 03:56 AM |