Closed skttl closed 5 years ago
What would decimal fields be used for and how are they different from a text field with a regex validator?
If this is needed then we should think about: maybe it's better to configure the text box datatype as:
Decimal fields would be used for inputting decimals. The specific use case I have right now is a speed input, where the value needs to be decimal. I know a regex validator can help, but that doesn't make it a decimal, when models builder does it's magic. I am then required to convert it myself.
I like your suggestion of a more dynamic textbox editor. Eg. you could be able to get from the email setting, which makes it easier to input emails on touch devices. But I guess that is going to be a bit bigger change, and also breaking?
There is already a numeric data type in core. Maybe that can be extended to support floats ?
Dave
@skttl can't you create an datatype instance of Umbraco.Decimal
?
ModelsBuilder generate the property as type of decimal
.
@bjarnef
I didn't even know it existed 🤦♂️
Dave
@dawoe many doesn't know about these because there by default is no instances of these. For example we also have a Umbraco.EmailAddress
property editor.
Here is a list of the built-in property editors: https://our.umbraco.com/documentation/Getting-Started/Backoffice/Property-Editors/Built-in-Property-Editors/
@bjarnef d'oh, why didn't I know that one? 🤦♂️ exactly what I needed!
Maybe there should by default exists an instance of Umbraco.EmailAddress
and Umbraco.Decimal
?
Furthemore I always create an "Image Picker" using Umbraco.MediaPicker2
which doesn't allow selecting multiple media and disable folder select - just for a single image picker (and if needed a Multiple Image Picker).
I also configurate a "Single Url Picker" and "Multi Url Picker" using Multi Url Picker package which not is in core (yet): https://github.com/umbraco/Umbraco-CMS/pull/2323
Now with folders, maybe some of these should be grouped into folder, e.g. "Basic", "Listviews", "Grid" or whatever makes sense.
Any thoughts on this @nul800sebastiaan @hartvig ?
@bjarnef I like it (all of it)
@bjarnef Yup! I do almost all of them as well :-)
Decimal fields would be used for inputting decimals. The specific use case I have right now is a speed input, where the value needs to be decimal. I know a regex validator can help, but that doesn't make it a decimal, when models builder does it's magic. I am then required to convert it myself.
I like your suggestion of a more dynamic textbox editor. Eg. you could be able to get from the email setting, which makes it easier to input emails on touch devices. But I guess that is going to be a bit bigger change, and also breaking?
Old but I wanted add a reason as I came across this today. Having a listing of projects that go 1.0 through to 7.0, 7.1...7.9, 7.10 And needing to sort in that order. If you did as a string 7.10 will come after 7.1 not 7.9. Decimal you could properly order by
Just like we have a default numeric (integer field), we need a decimal field. I thought you could set the step value to 0,1 as usual with a
<input type="number">
in order to make it decimal, but it saves as integers, and Models Builder (of course) makes it an int.I could make a regular textstring, and do some Regex magic in order to enforce a decimal number. But Models Builder would make it a string by default.