Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7843979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:44:03+00:00 2026-06-02T16:44:03+00:00

I am using Formtastic 1.2.3. I want the current date and time already to

  • 0

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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T16:44:05+00:00Added an answer on June 2, 2026 at 4:44 pm

    I’ve done this by setting the value in the active record object directly when it’s created like so:

    In the model class:

    def after_initialize
      self.start_time ||= Time.now
    end
    

    Then when the form is displayed, it will already have the time populated and set correctly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to setup a simple form using formtastic but running into a
I am using formtastic to render a form for a object of a model
I am trying to set up a form using Formtastic which has a drop
I have rails 3.1.3 and formtastic 2.0.2. I'm using the most basic form you
I'm using formtastic to collect information from a form and post dirctly to an
I'm using formtastic & formtastic_cocoon to created a nested form. All seems to be
Many form fields (and form builders - simple_form, formtastic) use 'Hints' to explain more
I am trying to create a nested form using formtastic. I've included my code
I'm using ActiveAdmin and Formtastic. I have an invoice form that has a drop
iam using rails with formtastic for my admin backend. i want to be able

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.