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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:20:52+00:00 2026-05-26T11:20:52+00:00

I have a form where the user will select a date range, and then

  • 0

I have a form where the user will select a date range, and then a report will be presented based on that date range.

The relevant bit of my Rails form looks like this…

<div class="field">
<b>Start Date</b><br />
<%= date_select :startDate, options = {:order => [:day, :month, :year]} %>
</div>

<div class="field">
<b>End Date</b><br />
<%= date_select :endDate, options = {:order => [:day, :month, :year]} %>
</div>

However, I’m having trouble figuring out how to access the resulting dates in the controller. I’ve put the following diagnostics in the controller,

puts params[:startDate]
puts params[:endDate]
puts Date.today

…and this shows,

orderdaymonthyear(1i)2011orderdaymonthyear(2i)3orderdaymonthyear(3i)21
orderdaymonthyear(1i)2011orderdaymonthyear(2i)10orderdaymonthyear(3i)21
2011-10-21

My search, is defined at follows,

SalesActivity.find(:all, :conditions => {:created_at => params[:startDate]..params[:endDate]})

…and this gives the exception, ‘bad value for range’.

Pointers to how to pass and use a Date range would be 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-26T11:20:52+00:00Added an answer on May 26, 2026 at 11:20 am

    Thanks to the helpful suggested answers, I learned that the area I needed to dig into was multiparameter attributes. However, the answer referenced by Julik seems more complex than what I need.

    However, I did find this,

    http://snippets.dzone.com/posts/show/4630

    Which gave me what I was looking for so, my [now working] code looks like this,

    @start_date = Date.civil(params[:range][:"startDate(1i)"].to_i,
                             params[:range][:"startDate(2i)"].to_i,
                             params[:range][:"startDate(3i)"].to_i)
    
    @end_date   = Date.civil(params[:range][:"endDate(1i)"].to_i,
                             params[:range][:"endDate(2i)"].to_i,
                             params[:range][:"endDate(3i)"].to_i)
    

    Thanks again for the help.

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

Sidebar

Related Questions

I have a form a user can enter their name, then it will add
I have a delete form wherein the user will enter the pnum to be
I have a form which have many check boxes in it. User will check
I currently have form that checks if a user has unsubmitted changes when they
I am looking for a jQuery plugin that will allow the user to select
I have a repeater that displays a custom user control on a form multiple
I'm creating a form where the user will select n days from a list
I'm making a registration form which will have the user put in his birthday.
I have a form where a user selects a file, and then should be
Ok so in my html/js i have a form that updates based on the

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.