Issue Bug Closed

#94930TCA eval num wrongly renders input field as HTML type=number

S P 08/19/21, 06:43 updated 10/16/24, 08:14

Description

The TCA evals int and num render the form field as HTML type="number". But this is only valid for int, not for num.

The DataHandler and the documentation for num correctly say that only characters in [0-9] are allowed. So the resulting string is no integer number, still only a string: a “num” evaluated field is according to DataHandler and docs fully valid to contain leading zeros. Just think of german postal codes or custom serial numbers with fixed length but leading zeros. For such fields the up/down buttons that modern browsers render for HTML type="number" fields are totally wrong in this case. Some Browsers even seem to auto-strip leading zeros in such fields, which is wrong for eval num.

The correct rendering for “num” would be type="text" with a pattern="[0-9]*" (maybe also even respecting min nand max already in the pattern and not just in the min and max HTML attributes).

Discovered on v9, but seems valid for later versions as well.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

History 3

  1. S P changed TYPO3 Version 9 10 10/20/21, 06:28

  2. S P commented 10/16/24, 08:08

    Can be closed, works on v12. “eval => num” renders as type="text" , and for type="number" there is a dedicated TCA type “number”

  3. Oliver Bartsch commented and changed status New Closed 10/16/24, 08:14

    Closed as requested by the author.