Proposing new Property Elements: displayFormat and editFormat
While type can guide the client which type of input to render, this still leaves room on how to render the value.
For example a number can have a different number of digits after the decimal point, or should be padded with 0s.
A datetime-local might be displayed just as a date when it is readOnly: true, but with time when editing the value.
In contrast to the placeholder this is not intended to be displayed to the user, but for the rendering of values.
So I'm proposing new OPTIONAL Property Elements
displayFormatis a string that instructs the interface how to render a value that is not in edit mode (maybe because it is read only).editFormatis a string of the same format, but is used when editing the value.
If a client does not support these elements, it can just render the value as if they where not present.
As I have a strong .Net background, I propose those formats to be possible values (There is also an npm package implementing the same format clr-format):
- format:
"{0:N2}", value:1234.567, browser-locale:en-us=>"1,234.45" - format:
"{0:F1}", value:1234.567, browser-locale:de-de=>"1234,5" - format:
"Foo {0} Baz", value:"Bar", browser-locale:doesn't matter=>"Foo Bar Baz"
However I'm open minded of the structure of the string.