Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More HTML5 goodness, please! #46

Closed
dasch opened this issue Sep 3, 2010 · 5 comments
Closed

More HTML5 goodness, please! #46

dasch opened this issue Sep 3, 2010 · 5 comments

Comments

@dasch
Copy link
Contributor

dasch commented Sep 3, 2010

Seeing as Chrome 6 now joins Safari in adding custom UI on top of <input type="number"/> elements, it would be awesome if it was easier to add the new attributes to the element.

In particular, min, max, and step would improve the experience, also on mobile devices.

Could these be inferred by the presence of a NumericalityValidator? Otherwise, allowing these options directly in the input call would be preferred over having to use :input_html.

I love simple_form!

@carlosantoniodasilva
Copy link
Member

I believe min and max could be inferred by the NumericalityValidator, but to use step you'd still have to use :input_html.
Could you work on a patch and send us a pull request? Thanks.

@dasch
Copy link
Contributor Author

dasch commented Sep 5, 2010

I've read through NumericalityValidator, and there's no public API exposed that could be used. Is it okay if I cheat and use the private internals of the class? What's your policy on that?

@carlosantoniodasilva
Copy link
Member

You can use the public API:

User.validators_on(:age) # will give you an array with all validators in this attribute

You can detect if there is an NumericalityValidator and get its options to create the needed html attributes.

@dasch
Copy link
Contributor Author

dasch commented Sep 5, 2010

I sent a pull request at http://github.com/plataformatec/simple_form/pull/47

@dasch
Copy link
Contributor Author

dasch commented Sep 6, 2010

The pull request issue is at #47.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants