The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> INPUT TAG
Haider
post 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.

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Oct 10 2018, 12:07 AM
Post #2


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



Say what? unsure.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Haider
post Oct 10 2018, 12:15 AM
Post #3





Group: Members
Posts: 2
Joined: 9-October 18
Member No.: 26,728



QUOTE(pandy @ Oct 10 2018, 12:07 AM) *

Say what? unsure.gif



i want to create a text box in html for typing only alphabetical values.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Oct 10 2018, 06:14 AM
Post #4


.
********

Group: WDG Moderators
Posts: 9,628
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.




User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 19th March 2024 - 05:01 AM