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 935339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:08:27+00:00 2026-05-15T21:08:27+00:00

I am using the Rails helper datetime_select in one of my forms. I currently

  • 0

I am using the Rails helper datetime_select in one of my forms. I currently have a requirement to change the dropdowns for day, year, hour, and minute to be textboxes with validation. Is there a way I can specify that I want textboxes for these fields? Or possibly a different helper that will do what I need?

here is my usage:

datetime_select(:campaign, :start_date, :order => [:day, :month, :year, :hour, :minute])
  • 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-05-15T21:08:27+00:00Added an answer on May 15, 2026 at 9:08 pm

    how about rolling your own simple helper, like

    def datetime_text_fields(object_name, method)
      html = text_field_tag("#{object_name}[#{method}(3i)]", Date.today.day.to_s, :length => 2)
      html << select_month(Date.today, :field_name => "#{object_name}[#{method}(2i)]")
      html << text_field_tag("#{object_name}[#{method}(1i)]", Date.today.year.to_s, :length => 4)
      html << " "
      html << text_field_tag("#{object_name}[#{method}(4i)]", Time.now.hour.to_s, :length => 2)
      html << ":"
      html << text_field_tag("#{object_name}[#{method}(5i)]", Time.now.min.to_s, :length => 2)
    end
    

    Feel free to add more formatting stuff/separators etc. but it basically returns to correct field names for rails to be identified as DateTime. Rails expects fields named like date(1i), 1i = year, 2i = month etc.

    Honestly I didn’t test it or anything, but the output in console looked pretty convincing 😉

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

Sidebar

Related Questions

Edit: More Detailed and to the point I'm using Rails 3: I currently have
I have a naked rails 3 app with one model, generated using rails g
I have a rails helper using the structore below, but when I use it
I am using the Rails date_select helper. :start_year => Time.now.year :end_year => 1910 I
I'm asking about using a Twitter Bootstrap modal window with a Rails form helper
In my rails app, I am using calendar helper cell.innerHTML = '<%= calendar_for('start_date')%>'; The
I am using a rails helper that creates 3 select lists for the purpose
I'm using rails' select helper on my page, dynamically populated with Categories on a
Using the rails button_to helper I'm trying to run the update method in a
Using Rails 3, is there a way to use link_to helper, or any helper

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.