form date helper with text year

2 views
Skip to first unread message

AppleII717

unread,
Jul 26, 2010, 10:23:36 AM7/26/10
to Ruby on Rails: Talk
I have a date where the year range is more then I want to define in a
select_date scaffold generated year range.

My idea was to have the year entered as a text field and the month and
day using something like:

<%= select_month @person.born,:prefix => :person ,:field_name =>
"born(2i)" %>
<%= select_day @person.born,:prefix => :person , :field_name =>
"born(3i)" %>

<%= f.text_field ?????? or text_field_tag ???????? field_name =>
"born(1i)" %>

I just can't seem to find the set of options to build the year tag.
Guess I also would have to extract the year out of the date for the
value.

Can't seem to find any examples and looking for help.

AppleII717

unread,
Jul 26, 2010, 12:08:53 PM7/26/10
to Ruby on Rails: Talk
I'll answer my own question:

<%= select_month @person.born,:prefix => :person ,:field_name
=> "born(2i)" %>
<%= select_day @person.born,:prefix => :person , :field_name
=> "born(3i)" %>
<%= text_field_tag "person[born(1i)]", value =
@person.born.year,:size => 4 %>
Reply all
Reply to author
Forward
0 new messages