I want to have a date input for a form. I know this only works in some browsers:
<input type="date" name="birth_day"/>
Is there a convenient method for this in Ruby on Rails? The documentation for the various form elements list many other input types, but I don't see anything for dates:
I know about date_select, that's not what I want. I want the above HTML output. I'm using Ruby on Rails 3.2.13. Is there possibly a date_field
in Ruby on Rails 4? Or another way to do this?
The ones that claim to be accessible aren't. For example, we know <input type="date"> is a problem for voice users across browsers. Graham Armfield already produced a thorough report on the accessibility of the native control and came to conclusion that nope, it is not accessible.
This can be used for: creating new database records, building a contact form, integrating a search engine field, and pretty much every other aspect of the application that requires user input.
You can see the lastest docs that the date_field
helper provide that. That seems a functionality from Rails 4.
Example from docs:
date_field("user", "born_on")
# => <input id="user_born_on" name="user[born_on]" type="date" />
For older versions of Rails I believe you can use:
.text_field(type: 'date')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With