Feature #7279
closedFeature #7894: Add more HTML5 input types
WLineEdit add support for HTML5 email type
100%
Description
Hi,
I'm wondering why current implementation of WLineEdit has no support for HTML5 input control?
Today most of the users have HTML5 cable browsers... I don't like to add w WRegExpValidator() with complex regexp if the browser already has an immplementation!
Regards,
Stefan
Updated by Roel Standaert about 5 years ago
Probably just because we never got around to it. Do note the difference between Wt's validators and the specialized HTML elements, though: Wt's validators (also) do server side validation, though in the case of email addresses you usually just want to verify them by sending a verification email.
Updated by Stefan Ruppert about 5 years ago
In the first place I was wondering, secondly I also want to check it on server side...
What about providing an WEMailInput() widget class by wt which hides the WRegExpValidator()?
Regards,
Stefan
Updated by Roel Standaert almost 4 years ago
- Related to Feature #7894: Add more HTML5 input types added
Updated by Roel Standaert almost 4 years ago
- Description updated (diff)
- Parent task set to #7894
Updated by ruben kindt over 3 years ago
- Assignee set to ruben kindt
- Target version set to 4.7.0
Updated by Roel Standaert over 2 years ago
- Target version changed from 4.7.0 to 4.8.0
Updated by Roel Standaert over 2 years ago
- Status changed from New to InProgress
- Assignee set to Roel Standaert
Updated by Roel Standaert over 2 years ago
- Assignee deleted (
Roel Standaert) - Target version changed from 4.8.0 to future
Updated by Roel Standaert almost 2 years ago
- Assignee set to Roel Standaert
- Target version changed from future to 4.10.0
Updated by Roel Standaert almost 2 years ago
Turns out browser support is still a bit inconsistent. While all of the major browser families (Chrome, Firefox and Safari), do have support for it:
- Firefox does not sanitize its
value
so it will keep leading and trailing whitespace (see https://html.spec.whatwg.org/multipage/input.html#email-state-(type=email): strip newlines from the value, strip leading and trailing ASCII whitespace from the value): https://bugzilla.mozilla.org/show_bug.cgi?id=849611 - Firefox and Safari do not Punycode encode their
value
, and consider internationalized domain names invalid.
Either the experience will be inconsistent between browsers, or we'd have to write a bunch of code to smooth over the differences.
Currently, I'm thinking we do both a WEmailEdit
and a WEmailValidator
with the following details:
- Do the sanitization ourselves even if the browser doesn't. This bit is done by the
WEmailEdit
before it is even passed to the validator. - The validator uses the regular expression from the WHATWG spec, even if this does not accept all theoretically possible email addresses.
- Ignore the Punycode thing: if an internationalized domain name is used in Chrome it will be accepted, but for now it won't be in Firefox and Safari (unless the user enters them in Punycode in the first place).
Updated by Roel Standaert almost 2 years ago
- Status changed from InProgress to Review
- Assignee deleted (
Roel Standaert)
Updated by Roel Standaert over 1 year ago
- Status changed from Review to Implemented @Emweb
- Assignee set to Roel Standaert
- % Done changed from 0 to 100
Updated by Roel Standaert over 1 year ago
- Status changed from Implemented @Emweb to Resolved
Updated by Matthias Van Ceulebroeck over 1 year ago
- Status changed from Resolved to Closed