Solved

how to make select element 'remember' previous value

Posted on 2011-09-19
2
381 Views
Last Modified: 2012-05-12
so in a rails app i have this collection_select element as part of a form. When creating a story object it works fine but on subsequent edits the select element never remembers the previous value, users rarely change the edition during an edit but ofter forget to check it. So how to i make it remember its value when editing?



<%= collection_select(:story, :edition_id, Edition.all, :id, :name, {:include_blank => '-select story type-'} ) %>
0
Comment
Question by:depassion
2 Comments
 
LVL 10

Accepted Solution

by:
Andrew Doades earned 500 total points
ID: 36563766
Is the edition_id being stored in the database correctly?
I have a similar collection select that works OK:

<%= collection_select 'sub_category', 'parent_id', @categories, :id, :description, {:include_blank => true} %>
0
 

Author Comment

by:depassion
ID: 36565127
oh yeah, i was storing edition_id as a string, which should of course be an integer. Works now, thanks.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to dynamically set the form action using jQuery.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question