Skip to content

'step' attribute should default to "any". #650

merged 1 commit into from Aug 10, 2011

2 participants


Right now the step attribute for number_input defaults to '1' when cannot be inferred from validations and is not either supplied in the options.

It is ok for integer values, but when you have a float field in the database, an input type="number" is also rendered with step="1" and the browser doesn't submit the form when you enter a non-integer value. I think in this case it should use step="any"


This patch makes the step attribute defaults to "any" instead of "1".


Seems good for me.

What happens in modern browsers when step is set to any?


If you use step="any" modern browsers let you send float values. If you don't use it and use step="1" instead, modern browsers let you send only integer values.

I have to say that I only tested that with Chrome 13.


According to W3C, this is the specification.

Thanks for submitting.

@sobrinho sobrinho merged commit d6762c4 into justinfrench:master Aug 10, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.