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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:55:48+00:00 2026-05-23T07:55:48+00:00

Rails 2.3.11 I’m trying to add a drop-down sort by switch to a page.

  • 0

Rails 2.3.11

I’m trying to add a drop-down “sort by” switch to a page. The page determines how to sort the items in the list by a URL argument (http://…/places?sort=name). How would I have a drop-down menu that, when changed, goes to the appropriate page?

"Name"            -> ?sort=name
"Category"        -> ?sort=cat
"Abbreviation"    -> ?sort=abbrev
"Building Number" -> ?sort=num

Those ^ are the mappings. I’m also not sure how to have the drop-down menu say one thing, but submit another.

Thank you!

  • 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-23T07:55:48+00:00Added an answer on May 23, 2026 at 7:55 am
    options = options_for_select [['Name','name'],['Category','cat'],['Abbreviation','abbrev'],['Building Number','num']]
    select_tag :sort, options
    

    Basically you build the options out first by passing an Array of 2 element arrays where the first element is your display value, and the second element is the select value. options_for_select will generate all the options for you, which you can then pass to select_tag.

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

Sidebar

Related Questions

Rails model: Categories have items Trying to get a list of categories that actually
rails 2.3.4, sqlite3 I'm trying this Production.find(:all, :conditions => ["time > ?", start_time.utc], :order
rails: I have 'create' and 'update' using the same partial '_form' but the url
Rails 3 on Apache with Passenger: I need to take down Rails so that
Rails 2.3.5 For a link_to image_tag', I've been trying to figure out how to
Rails 2.3 has an option to add more routes anytime using RouteSet#add_configuration_file. Is it
Rails 3 allow to send static files directly and more performantly to HTTP clients
rails newbie here. I've started making a value based to-do list. So far I've
Rails newbie here, trying to get a new controller working. When I try to
Rails 2.35 / Ruby 1.87 I've been trying jqplot . With Fusion Charts, I

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.