Topic: dropdown list question

Can somebody refresh my memory as to how to access the value of a drop down list?

Right now my view is like this:

<b>Select Quote no: </b>
<select size ="1" name="record[quote_no]">
<% @quotes.each do |quote| %>
    <option value ="<%= quote.QuoteNo %>">
          <%=quote.QuoteNo%>
        </option>
       
<% end %>
</select>

I'm defining @quotes in my controller and the values are coming out right.  But how to grab the value selected?

It's a rails app built on a legacy dbase scheme so QuoteNo is the name of the field in the records table.

I tried warn params[:record][:quote_no] but it throws me a nil error:

You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.[]

Thanks...

Re: dropdown list question

The params[:record[:quote_no] should return the selected value. Where are you placing this code? Is it in the resulting controller action that is run after the form is submitted?

Check out the development.log and see if the parameters are being passed properly through the request.

Railscasts - Free Ruby on Rails Screencasts