#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    174
    Rep Power
    12

    Holding selection in select_tag


    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:

    Code:
    <%=select_tag('public_all_categories', options_for_select({ :Public => 1, '--Choose--' => '',  :Private => 0})) %>
    Thanks for your help
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    174
    Rep Power
    12
    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!!!

IMN logo majestic logo threadwatch logo seochat tools logo