Set minimal and step attributes for (currency) number input fields

If the step attribute not set, the default step is set to 0.50, which is
inconvient since it is also used for validation, i.e. if you have 35.50 in
the field, the only surrounding values 36.0 and 35.0 are valid, not 35.60.
This commit is contained in:
Paul van Tilburg 2018-10-15 19:40:28 +02:00
parent 548dfe22cc
commit fa6aa24e0d

View file

@ -2339,7 +2339,7 @@ module StopTime::Views
_form_input_radio("type", "hourly_rate", true)
text!("Hourly rate: ")
div.input_group do
_form_input("hourly_rate", :number, "Hourly rate")
_form_input("hourly_rate", :number, "Hourly rate", min: "0.00", step: "0.01")
span.input_group_addon "€ / h"
end
end
@ -2349,7 +2349,7 @@ module StopTime::Views
_form_input_radio("type", "fixed_cost")
text!("Fixed cost: ")
div.input_group do
_form_input("fixed_cost", :number, "Fixed cost")
_form_input("fixed_cost", :number, "Fixed cost", min: "0.00", step: "0.01")
span.input_group_addon ""
end
end