I have created a scaffold, part of which was dob:date
When I view my web page under DOB, I have only the years listed from 2005-2015. What should I do to enter older years?
Thanks.
I have created a scaffold, part of which was dob:date
When I view my web page under DOB, I have only the years listed from 2005-2015. What should I do to enter older years?
Thanks.
I have created a scaffold, part of which was dob:date
When I view my web page under DOB, I have only the years listed from 2005-2015. What should I do to enter older years?
See the docs for date_select (even if it's a datetime_select the same options work). Specifically:
:start_year - Set the start year for the year select. Default is Time.now.year - 5. :end_year - Set the end year for the year select. Default is Time.now.year + 5.
Philip Hallstrom wrote:
I have created a scaffold, part of which was dob:date
When I view my web page under DOB, I have only the years listed from 2005-2015. What should I do to enter older years?
See the docs for date_select (even if it's a datetime_select the same options work). Specifically:
:start_year - Set the start year for the year select. Default is Time.now.year - 5. :end_year - Set the end year for the year select. Default is Time.now.year + 5.
Thanks Philip.
I'm actually new to RoR. Where can I make this change?
Thanks.
In the view file. Find the file that has the form and then look for date_select and add the options...
Philip Hallstrom wrote:
Right. And one of those .html.erb files will have the field you want...
Philip Hallstrom wrote:
In the view file. Find the file that has the form and then look for date_select and add the options...
If you mean the "views" folder, there is nothing actually on it. Just *.html.erb
Right. And one of those .html.erb files will have the field you want...
I found the date_select, but got the following error. Any ideas?
compile error /Users/abder/Desktop/RoR projects/student_info/app/views/students/new.html.erb:16: syntax error, unexpected ':', expecting ')' ...year=>1950, :end_year=>2010) :dob ).to_s); @output_buffer.co...
Extracted source (around line #16):
13: </p> 14: <p> 15: <%= f.label :dob %><br /> 16: <%= f.date_select(:start_year=>1950, :end_year=>2010) :dob %> 17: </p> 18: <p> 19: <%= f.label :major %><br />
Thanks.
you'll need the object and method,
http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html#M002264
kind regards -botp
botp wrote: