Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8519885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:22:40+00:00 2026-06-11T06:22:40+00:00

I have a select tag that is built like this: <%= f.select(:id, category_options, include_blank:true)

  • 0

I have a select tag that is built like this:

<%= f.select(:id, category_options, include_blank:true) %>

The form displays fine and the appropriate model item’s option tag is selected. However, when the user selects a different option and submits the form, the new option is not passed to the server. Instead, the originally selected value is passed to the server.

The rails log shows the old values being submitted, not the new ones. The values for this input appear to be cached.This happens in development and production, and in development cache_classes = false.

The rails log like this:

Started PUT “/posts/1999” for 127.0.0.1 at 2012-09-11 13:42:51 -0400
Processing by GalleriesController#update as HTML

Parameters: {“utf8″=>”✓”, “authenticity_token”=>”…”, “gallery”=>{“publish_on”=>”2012-09-18”, “poster_file_temp”=>””, “thumb_file_temp”=>””, “models_attributes”=>{“0″=>{“id”=>”116”, “_destroy”=>”false”}, “1”=>{“id”=>”6409”, “_destroy”=>”false”}}, “categories_attributes”=>{“0″=>{“id”=>”59”, “_destroy”=>”false”}}, “thumb_zip_input”=>””, “medium_zip_input”=>””, “large_zip_input”=>””, “website_url”=>””, “commit”=>”Upload”, “id”=>”1999”}

The form looks like this:

        <form accept-charset="UTF-8" action="/galleries/1999" class="edit_gallery" enctype="multipart/form-data" id="edit_gallery_1999" method="post" name="edit_gallery_1999">
        <div style="margin:0;padding:0;display:inline">
            <input name="utf8" type="hidden" value="✓"><input name="_method" type="hidden" value="put"><input name="authenticity_token" type="hidden" value="...">
        </div>
        <div class="vert">
            <label for="gallery_publish_on">Publish on</label> <input id="gallery_publish_on" name="gallery[publish_on]" size="30" type="text" value="2012-09-18"> <label for="gallery_poster_file">Poster file</label> <input id="gallery_poster_file_temp" name="gallery[poster_file_temp]" type="hidden"><input id="gallery_poster_file" name="gallery[poster_file]" size="30" type="file">
            <div class='formSection'>
                <img alt="Brandy" src="/content/gallery/poster_file/0000/1999/brandy.jpg">
            </div><label for="gallery_thumb_file">Thumb file</label> <input id="gallery_thumb_file_temp" name="gallery[thumb_file_temp]" type="hidden"><input id="gallery_thumb_file" name="gallery[thumb_file]" size="30" type="file">
            <div class='formSection'>
                <img alt="Thumb" src="/content/gallery/thumb_file/0000/1999/thumb.jpg">
            </div>
            <div id="models">
                <label for="Models">Models</label>
                <div>
                    <select id="gallery_models_attributes_0_id" name="gallery[models_attributes][0][id]">
                        <option value="6409">
                            April
                        </option>
                        <option value="6366" selected="selected">
                            Brandy
                        </option>
                        <option value="9036">
                            Charlie
                        </option>
                        <option value="7490">
                            Craig
                        </option>
                        <option value="9881">
                            Donna
                        </option>
                    </select> <input id="gallery_models_attributes_0__destroy" name="gallery[models_attributes][0][_destroy]" type="hidden" value="false"> <a href="#" class="remove_fields">remove</a>
                </div><input id="gallery_models_attributes_0_id" name="gallery[models_attributes][0][id]" type="hidden" value="6366"> <a href="#" class="add_fields" data-fields="&lt;div&gt; &lt;select id=&quot;gallery_models_attributes_70106238269060_id&quot; name=&quot;gallery[models_attributes][70106238269060][id]&quot;&gt;&lt;option value=&quot;&quot;&gt;&lt;/option&gt;&lt;option value=&quot;6409&quot;&gt;April&lt;/option&gt;&lt;option value=&quot;6366&quot;&gt;Brandy&lt;/option&gt;&lt;option value=&quot;9036&quot;&gt;Charlie&lt;/option&gt;&lt;option value=&quot;7490&quot;&gt;Craig&lt;/option&gt;&lt;option value=&quot;9881&quot;&gt;Donna&lt;/option&gt;&lt;/select&gt; &lt;input id=&quot;gallery_models_attributes_70106238269060__destroy&quot; name=&quot;gallery[models_attributes][70106238269060][_destroy]&quot; type=&quot;hidden&quot; value=&quot;false&quot; /&gt; &lt;a href=&quot;#&quot; class=&quot;remove_fields&quot;&gt;remove&lt;/a&gt;&lt;/div&gt;" data-id="70106238269060">add model</a>
            </div>
            <div id="categories">
                <label for="Categories">Categories</label>
                <div>
                    <select id="gallery_categories_attributes_0_id" name="gallery[categories_attributes][0][id]">
                        <option value="1">
                            Amateur
                        </option>
                        <option value="2">
                            Animals
                        </option>
                        <option value="49">
                            Articles
                        </option>
                        <option value="3">
                            Art
                        </option>
                        <option value="7">
                            Blog
                        </option>
                    </select> <input id="gallery_categories_attributes_0__destroy" name="gallery[categories_attributes][0][_destroy]" type="hidden" value="false"> <a href="#" class="remove_fields">remove</a>
                </div><input id="gallery_categories_attributes_0_id" name="gallery[categories_attributes][0][id]" type="hidden" value="59"> <a href="#" class="add_fields" data-fields="&lt;div&gt; &lt;select id=&quot;gallery_categories_attributes_70106278052860_id&quot; name=&quot;gallery[categories_attributes][70106278052860][id]&quot;&gt;&lt;option value=&quot;&quot;&gt;&lt;/option&gt;&lt;option value=&quot;1&quot;&gt;Amateur&lt;/option&gt;&lt;option value=&quot;2&quot;&gt;Animal&lt;/option&gt;&lt;option value=&quot;49&quot;&gt;Articles&lt;/option&gt;&lt;option value=&quot;3&quot;&gt;Art&lt;/option&gt;&lt;option value=&quot;7&quot;&gt;Blog&lt;/option&gt;&lt;/select&gt; &lt;input id=&quot;gallery_categories_attributes_70106278052860__destroy&quot; name=&quot;gallery[categories_attributes][70106278052860][_destroy]&quot; type=&quot;hidden&quot; value=&quot;false&quot; /&gt; &lt;a href=&quot;#&quot; class=&quot;remove_fields&quot;&gt;remove&lt;/a&gt;&lt;/div&gt;" data-id="70106278052860">add category</a>
            </div>
            <div id='photoset_files'>
                <fieldset>
                    <legend>Zip Files</legend> <label for="gallery_thumb_zip_input">thumb zip</label> <select id="gallery_thumb_zip_input" name="gallery[thumb_zip_input]">
                        <option value="/Library/WebServer/Documents/uploads/thumb copy.zip">
                            thumb copy.zip
                        </option>
                        <option value="/Library/WebServer/Documents/uploads/thumb.zip">
                            thumb.zip
                        </option>
                    </select>&nbsp;[ thumb.zip ]<br>
                    <label for="gallery_medium_zip_input">medium zip</label> <select id="gallery_medium_zip_input" name="gallery[medium_zip_input]">
                        <option value="/Library/WebServer/Documents/uploads/medium copy 10.zip">
                            medium copy 10.zip
                        </option>
                        <option value="/Library/WebServer/Documents/uploads/medium copy 9.zip">
                            medium copy 9.zip
                        </option>
                        <option value="/Library/WebServer/Documents/uploads/medium copy.zip">
                            medium copy.zip
                        </option>
                        <option value="/Library/WebServer/Documents/uploads/medium.zip">
                            medium.zip
                        </option>
                    </select>&nbsp;[ medium.zip ]<br>
                    <label for="gallery_large_zip_input">large zip</label> <select id="gallery_large_zip_input" name="gallery[large_zip_input]">
                        <option value="/Library/WebServer/Documents/uploads/large copy 10.zip">
                            large copy 10.zip
                        </option>
                        <option value="/Library/WebServer/Documents/uploads/large copy 9.zip">
                            large copy 9.zip
                        </option>
                        <option value="/Library/WebServer/Documents/uploads/large copy.zip">
                            large copy.zip
                        </option>
                        <option value="/Library/WebServer/Documents/uploads/large.zip">
                            large.zip
                        </option>
                    </select>&nbsp;[ large.zip ]<br>
                </fieldset>
            </div><label for="gallery_website_url">Website url</label> <input class="wider" id="gallery_website_url" name="gallery[website_url]" size="30" type="text" value=""> <input id="tluo" name="tluo" type="hidden" value="aHR0cDovL2tmLmRldi9nYWxsZXJpZXMvbGlzdA==">
            <div id="submit">
                <input data-disable-with="Uploading..." name="commit" type="submit" value="Upload"> &nbsp;&nbsp; <a href="/galleries/">Cancel</a>
            </div>
        </div>
    </form>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T06:22:41+00:00Added an answer on June 11, 2026 at 6:22 am

    This is because you are repeating the id and name attribute of select . This is not recommended to have two html elements with same id values

    try to change name of select or if you want to use this as array then specifying name this way may help you out

     gallery[categories_attributes][0][id][]
    

    This one I used to collect checked radio button values, it may work in your case

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a lightbox/modal that displays a form, but in select tag has a
I have a select tag that looks like this: <select style=background:#fa7171; color:#FFFFFF; name=product_type_sub id=product_type_sub
I have a select tag that looks like this: <select name=TZSelector id=TheTZSelector> <option>add another
I have some markup like this: <div class=field> <div class=selector id=uniform-blablabla> [select tag markup]
I have a select tag that looks like that: <select name=MySelect></select> At runtime, I
I have a g:select in my view that displays a list of products: <g:form
I have a select element that looks like this: <select id=productId> </select> My current
I have a select tag that is populated with a list of files each
So I have this select tag pulling a collection of pages for the user
I have data in a select tag that is POSTed back to my script.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.