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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:46:12+00:00 2026-05-24T15:46:12+00:00

I have created a custom date_Select field using 3 separate select fields: <%= f.select

  • 0

I have created a custom date_Select field using 3 separate select fields:

<%= f.select :day, options_for_select(User::DAYS), :include_blank => "Day:" %>
<%= f.select :month, options_for_select(User::MONTHS), :include_blank => "Month:" %>
<%= f.select :year, options_for_select(User::YEAR_RANGE), :include_blank =>"Year:" %>

In my User.rb (Model) I have this validation rule and also using validates_timelessness gem:

  MONTHS = ["January", 1], ["February", 2]..etc
  DAYS = ["01", 1], ["02", 2], ["03", 3]..etc
  START_YEAR = Time.now.year - 111
  END_YEAR = Time.now.year
  YEAR_RANGE = START_YEAR..END_YEAR

validates :birthday,   :timeliness  => {:on_or_before => lambda { Date.current }, :type => :date, :on_or_before_message => "Select a valid birthday"} 

I have created some tests which work perfectly fine with the date_select that comes with rails but that date_select is buggy which is why I opted for a custom one. My only issue now is I wish to get day, month and year to work with my :birthday symbol. How do I combine all 3 so that my :birthday symbol can use the select data? If that makes sense…

The date_select would have been perfect but it lets users submit a form without the yea being filled out and if a users chooses 1 for a day and clicks submit it will automatically select january. I haven’t found a way round that.

So I’m using 3 separate select fields which I want to combine and make work with :birthday just like date_select did.

Help is appreciated.

  • 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-24T15:46:12+00:00Added an answer on May 24, 2026 at 3:46 pm

    i would recommend using a date-select pop-up.

    There are several gems available. I have used the one detailed in http://www.rubyinside.com/calendar-date-select-a-lightweight-prototype-based-datetime-picker-for-rails-developers-573.html with success.

    Once you have a real date field you’ll be in a better position to perform date type validations including ranges and presence that you can be confident in worrectly with that type of data.

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

Sidebar

Related Questions

friends, i have created custom title bar using following titlebar.xml file with code <?xml
I have created a custom dialog for Visual Studio Setup Project using the steps
I'm using google app engine/python. And I have created a custom datatype and property.
I have created custom MembershipUser, MembershipProvider and RolePrivoder classes. These all work and I
If have created a custom role within SqlServer which I added to the db__denydatareader
I have created a custom TitleWindow whcih i use as a popup. The contents
I have created a custom list as a feature in sharepoint. i need to
I have created a custom ExpandableListAdapter and everything works properly. What I'd like to
I have created a custom workflow activity that copies attachments from a case to
I have created a custom tag that looks like this: def textField = {

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.