jinky32 / my3-fed-repository

0 stars 0 forks source link

Forms/Text Input - Three mobile number. #26

Open jinky32 opened 9 years ago

jinky32 commented 9 years ago

From Team Berners-Lee's Form Fields Standards

Label: Three mobile number.

Sub Text: If you're getting in touch about a coverage issue, please provide an alternative contact number

Type: Textbox

Validation / Syntax:

Error Message: Please enter a valid Three mobile number.

jinky32 commented 9 years ago

Consider

<input type="number">
papafed commented 9 years ago

<input type="number" /> is the wrong one - that will result in a spinner (in aware user-agents) The one we need is <input type="tel" /> which gives you a text input with a number keypad on mobiles, and possibly some UA-side validation.

papafed commented 9 years ago

Also, for this and other telephone number fields, we must get out of the mentality of rigidly enforcing an input format for phone numbers because there are all sorts of perfectly valid ways of writing a phone number. We should allow spaces, braces, dashes, etc, and sanitise on the back end rather than enforce a format on the front-end. The max amount of front-end validation should be "if you strip out all non-numeric characters are there 11 digits if the first is a zero, or 12 if not (because we assume a country code)". Sanitising on the back-end is also much better for application security.