Solved

how to make select element 'remember' previous value

Posted on 2011-09-19
2
367 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
Comment Utility
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
Comment Utility
oh yeah, i was storing edition_id as a string, which should of course be an integer. Works now, thanks.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

There is a huge demand for CodeIgniter among the PHP web developers due to its dynamic features and benefits these days. It is one of most popular and agile open source PHP framework for creating robust web applications in PHP web development field.…
I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

743 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

17 Experts available now in Live!

Get 1:1 Help Now