PDA

View Full Version : holding selection in select_tag


clem_c_rock
April 7th, 2007, 08:13 PM
I'm new to rails and I haven't seen much decent documentation on using the select_tag helper.

I'm having 2 problems:

Holding the selected item in the select box after the form is submitted and also keeping the order of the select items consistent.

Here's the code I'm trying:


<%=select_tag('public_all_categories', options_for_select({ :Public => 1, '--Choose--' => '', :Private => 0})) %>


Thanks for your help

clem_c_rock
April 9th, 2007, 11:06 AM
Thanks for your help. I solved the problem w/ this little bit:

<%= select_tag('public_all_categories',
options_for_select({ :Public => 1, '--Choose--' => '', :Private => 0},
params[ublic_all_categories])) %>

Problem solved!!!