We now have #1174640: Add new HTML5 FAPI element: number and should use it instead of the textfield-with-"custom"-validation widget.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Niklas Fiekas’s picture

Status: Active » Needs review
FileSize
5.75 KB

First try.

Status: Needs review » Needs work

The last submitted patch, 1519720-use-number-1.patch, failed testing.

yched’s picture

So the patch removes the "customizable decimal separator" feature altogether - which is some ugly/fragile piece of code.
How would that be handled by the HTML5 number element ? Does this rely on browser locale settings ?

Niklas Fiekas’s picture

The browser must submit the value to the server with a dot.
On the client side, browsers can do whatever they want. Like helping the user by replacing "," with "." or doing such a replacement in the background, allowing only either of the two, etc.

Niklas Fiekas’s picture

Status: Needs work » Needs review
FileSize
1.64 KB
7.39 KB

Updating tests with the changed user interface texts.

sun’s picture

Status: Needs review » Reviewed & tested by the community

This looks good to go for me.

I merely wonder how html4 user agents will be handled - i.e., browsers which don't support any auto-conversion/localization for the decimal separator and so on. However, we can figure that out later on.

AFAICS, number fields always store their values with the regular/native decimal separator, so it also doesn't look like we need a update function here.

yched’s picture

We'd probably need an update function to remove the 'decimal_separator' setting from the definitions of existing decimal and float fields. No need to keep useless entries rotting in there.

Niklas Fiekas’s picture

@sun: Users would have to use a "." - otherwise the input will be rejected.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Looks good and committed to 8.x. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.