Text field not working |
Text field not working |
tudsy |
May 2 2018, 12:50 PM
Post
#1
|
Advanced Member Group: Members Posts: 246 Joined: 30-September 14 Member No.: 21,611 |
Hi
I am trying to ask a user for their Age (3 numbers) but I am getting the text field greater than 3 chars. <p align="center">3. Please input your Age:</p> <input type=“text” name=“Age” required=“required” maxlength=‘3’ size=‘3’ pattern=“[0-9]+” /> Any help will be appreciated. Tudsy |
pandy |
May 2 2018, 04:18 PM
Post
#2
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
Is that copied from the actual HTML document? In that case it's because you use curly quotes and prim signs. Use normal, straight quotes. And don't use Word and the like to write HTML or any other computer language, as wordprocessors may spiff up what you write with things like this. Use a plain text editor. Only ascii characters are allowed in the actual markup or code in case of programming. Same goes for CSS.
|
Christian J |
May 3 2018, 12:33 PM
Post
#3
|
. Group: WDG Moderators Posts: 9,656 Joined: 10-August 06 Member No.: 7 |
Also the SIZE attribute does not work very well in browsers to control textfield width, use CSS instead.
The PATTERN regex may not work like you want. [0-9] matches the zero character, and the + symbol allows one or more occurence of the character, meaning it allows user values like 0, 00 or 000 (the MAXLENGTH attribute prevents 0000 and longer strings). See also https://www.regular-expressions.info/numericranges.html |
Lo-Fi Version | Time is now: 24th April 2024 - 06:34 AM |