sara Tad
2006-Jun-26 14:59 UTC
[Rails] options_for_select-how to store cookie selected value ques.
#Controller cookies[:state] = state if state != nil and state.to_i != -1 conditions << ''stateid = ?'' cond_args << state cookies[:state] = state end if !cookies[:state].blank? @default_state = cookies[:state] else @default_state = "" end # view - html State: <td><%= select_tag "stateid", options_for_select(@state_names, :selected => @default_state) %></td> SOURCE OF HTML <td>State</td> *** I WANT THE VALUE IN THE State value="5.0" as the cookie. <td><select id="stateid" name="stateid"> <option value="-1">Any</option> <option value="0.0">OPEN</option> <option selected value="5.0">CLOSED</option> <option value="6.0">TEST</option> -- Posted via http://www.ruby-forum.com/.
Seemingly Similar Threads
- selected attribute in options_for_select
- How do I show the selected values in options_for_select? Not as simple as it sounds.
- options_for_select - how to set the selected value?
- options_for_select and setting css class values
- options_for_select - default nil value