Plugins - date_time_text_field_helpers
Add to favoritesdate_time_text_field_helpers
Apart from possibly the longest plugin name ever, these are a set of form helpers that use text fields instead of select dropdowns the standard Rails date form helpers use. Each date/time component gets its own text field which enables quicker entry using the keyboard while still using the built in Rails multi-parameter field handling.
Usage
So instead of:
date_select :person, :date_of_birth or time_select :person, :time_of_birth or datetime_select :person, :date_and_time_of_birth
use:
date_text_field :person, :date_of_birth or time_text_field :person, :time_of_birth or datetime_text_field :person, :date_and_time_of_birth
Example
The helpers return the date parts as text fields i.e.
date_text_field :person, :date_of_birth, :order => [:day, :month, :year], :blank => true
returns this for a new person record
<span id="person_date_of_birth" class="date_time_field">
<input id="person_date_of_birth_3i" class="day_field" type="text" value="" size="2" name="person[date_of_birth(3i)]"/>
-
<input id="person_date_of_birth_2i" class="month_field" type="text" value="" size="2" name="person[date_of_birth(2i)]"/>
-
<input id="person_date_of_birth_1i" class="year_field" type="text" value="" size="4" name="person[date_of_birth(1i)]"/>
</span>
Options
Most of the options which can be used with the standard Rails date helpers apply including :order, :default, :include_seconds and so on.
The new options are:
:date_separator - Sets the character displayed between the date components :time_separator - guess :date_time_separator - the separator between the date and the time parts :blank - acts like :include_blank option to use blank fields rather than the default current date/time if the column has no value yet.
http://github.com/adzap/date_time_text_field_helpers
http://github.com/adzap/date_time_text_field_helpers
Rails' (MIT)
View Extensions
