Topic: Drop-downs

Hi I'm fairly new to rails and I'm having a problem with my drop-downs. I'm finding it difficult to find any well defined explanations of how to use them and store the values on the web. The tutorials on this site are so well explained it seemed the best place to ask for an explanation!

Any help would be massively appreciated.

Just to further define what I'm trying to achieve. I have a table containing locations, essentially the choice of location will effect some of the other drop downs. Therefore I need to know how best to create a drop down and then store the selected value to create queries for subsequent drop-downs.

Sorry if that was poorly explained

Many thanks in advance

Re: Drop-downs

Apologies for the double post.

Currently I have 2 drop downs:

<%= select_tag("location", '<option value="1">House1</option> <option value="2">House2</option>' %>
<%= select("car", "id", {|p| [,] }) %>

@car = Car.find(:all, :conditions =>["location = ?", params[@selected_location] ])
@selected_car = @car[0]

however this is leaving my drop-down blank. Any advice?


Last edited by Dan Holmes (2010-07-14 12:29:57)

Re: Drop-downs

Have a look at  It might help.

Re: Drop-downs

you can visit also w3schools for guidance. i had a lot of help from there.

Blendtec Blender

Re: Drop-downs

After text is entered into a text box I would like the user to be able to use a drop down to select one of three options (right, left, and center) that would change the alignment of the text they have typed in the text box.
xxx match