Express number attribute doesn't allow decimal values

Permalink
I created an attribute named "Amount" for a "Donation" entity. I chose the "Number" type. But the forms don't allow entry of a decimal value. E.g. the value "25.52" shows a validation message of "Please enter a valid value. The two nearest valid values are 25 and 26.

Is there a way to allow decimal values? Should I have used a different attribute type?

 
hutman replied on at Permalink Reply
hutman
It seems this is a Chrome only issue, you can "fix" it by adding these lines to the /concrete/src/Form/Service/Form.php in the inputType function right above the return

if($type === 'number' && !array_key_exists('step', $miscFields)){
    $miscFields['step'] = 'any';
}

This adds step="any" to the number input which makes it accept any values, not just whole numbers.
tsorelle replied on at Permalink Reply
I tried this out and it works with some quirks. Anyway, I don't imagine you intended this to be a permanent fix. Better to make it a text field and somehow introduce some custom validation. Although, I don't like that either.

What I would really like to know is whether this is the expected behavior. Is the "Number" attribute type really supposed to represent an integer value and unsuitable for storing currency or decimal values? If so, are there plans to introduce a suitable attribute for the purpose?

Andrew Embler, could you comment please?
MrKDilkington replied on at Permalink Reply
MrKDilkington
I can confirm this in Chrome and Firefox on Windows using the latest GitHub develop branch.
tsorelle replied on at Permalink Reply
With MS Edge, you don't get the spinner control but you do get the validation error.