I am using Formtastic 1.2.3. I want the current date and time already to be selected when the form is loaded. I tried many combinations with :default or :selected, but none worked. Even from the github page of Formtastic I can’t get information on that. Any suggestions? Thanks for your time!
= form.input :date,:hint => 'Select a date',
:prompt => {:day => "Day", :month => "Month", :year => "Year"},
:start_year => Time.now.year
= form.input :time
I’ve done this by setting the value in the active record object directly when it’s created like so:
In the model class:
Then when the form is displayed, it will already have the time populated and set correctly.