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

  • Home
  • SEARCH
  • 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 960797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:14:15+00:00 2026-05-16T01:14:15+00:00

I have a rails form that has a datetime input. I’d like to make

  • 0

I have a rails form that has a datetime input.

I’d like to make the date input a single text box which the user will input in MM/DD/YYYY format (or via a jQuery datepicker) and then have the time inputs be 12 hour based time drop downs. I found this plugin – http://code.google.com/p/rails-twelve-hour-time-plugin/ – to handle the 12 hour time part but I’m not sure how to make the date (and only the date) a single textbox.

I was able to change it into multiple textboxes instead of multiple drop downs via this plugin – http://www.railslodge.com/plugins/981-date-time-text-field-helpers

I’d like to do it with minimal controller logic so if its possible to name the fields in such a way that rails knows how to concatenate them that would be ideal.

  • 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-16T01:14:16+00:00Added an answer on May 16, 2026 at 1:14 am

    In a single textfield you can only do that by a javascript mask, creating hidden fields with each part of the date in the input field.

    If you’re gonna have to use javascript anyway, use it to select the date or trust an user to input the date in a specified format, both scenarios would give you a formatted string, so you could simply parse it with

    # params[:date_as_str] = "2010/07/29 10:00 AM"
    object.date = DateTime.strptime(params[:date_as_str], "%Y/%m/%d %H:%M %p")
    

    you could also create a custom helper to make that “mask” of javascript on the single text field.

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

Sidebar

Related Questions

I have a rails model that validates uniqueness of 2 form values. If these
In my Rails app, I have a form which redirects through a foreign service,
I have a rails model that looks something like this: class Recipe < ActiveRecord::Base
I have a rails app that has picked up a bit of traction, but
I have a rails app (running on version 2.2.2) that has a model called
I have a rails form with a datetime_select field. When I try to submit
I have a rails application where each user has a separate database. (taking Joel
I have a rails application which is still showing the cachebusting numeric string at
I have a rails application running on a Linux server. I would like to
I have a Rails project which I neglected to build tests for (for shame!)

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.