Solved

how to make select element 'remember' previous value

Posted on 2011-09-19
2
372 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 camera licenses with purchase of My Cloud NAS

Milestone Arcus software is compatible with thousands of industry-leading cameras for added flexibility. Upon installation on your My Cloud NAS, you will receive two (2) camera licenses already enabled in the software. And for a limited time, get additional camera licenses FREE.

Question has a verified solution.

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

Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

910 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now