atk4 / ui

Robust and easy to use PHP Framework for Web Apps
https://atk4-ui.readthedocs.io
MIT License
439 stars 104 forks source link

Fix number input type for values over 1000 #2163

Closed mvorisek closed 4 months ago

mvorisek commented 4 months ago

UI numeric values/types are rendered using UI persistence and can contain non-numeric characters like space, comma.

repro

Currently, such correctly formatted UI values, are considered as bad, example:

image

can be reproduced on demos/form-control/multiline.php demo by writing 1 000 in "Qty" number input.

solution

The visual style is controlled by https://developer.mozilla.org/en-US/docs/Web/CSS/:invalid CSS presudo class which is set by https://developer.mozilla.org/en-US/docs/Web/HTML/Constraint_validation . In short, input type=number cannot be used for anything else than \d+ value, thus we need to set type to be different than number or do not set it at all.