开发者

Ruby on Rails User Date Input

开发者 https://www.devze.com 2023-01-05 18:35 出处:网络
I\'ve been search around for a good gem/plug-in to allow intuitive user input of a date(i.e. select a date from a pop-up calendar).

I've been search around for a good gem/plug-in to allow intuitive user input of a date(i.e. select a date from a pop-up calendar).

calendardateselect looks really good, but it's no longer in active development, and no longer installs correctly.

I found a few others, but they were all quite stale. What are Stack Overflow users using for date input in rails?

Per @bjg and @Fortuity jQuery UI is the direction I decided to go. G开发者_开发问答etting it up and running was a little complex, so I wrote a short how-to for others.


The jQuery UI Datepicker has been popular among Rails developers since Ryan Bates produced a screencast showing how to use it in a Rails application.

  • jQuery UI Datepicker (demos): http://jqueryui.com/demos/datepicker/
  • jQuery UI Datepicker (docs): http://docs.jquery.com/UI/Datepicker
  • Railscast #213 "Calendars": http://railscasts.com/episodes/213-calendars
  • ASCIIcast #213 "Calendars": http://asciicasts.com/episodes/213-calendars

For a Rails plugin that uses the jQuery UI Datepicker, look at:

  • Petrik de Heus's table_builder: http://github.com/p8/table_builder

Ryan's screencast includes hints for how to use it with Rails 3. The table_builder plugin is for Rails 2.3. I haven't yet seen a datepicker plugin for Rails 3 but it's easy to implement without a plugin.


If you are willing to consider JQuery in your application then the very actively supported jquery-ui project has a datepicker. See here for details

0

精彩评论

暂无评论...
验证码 换一张
取 消