Solved

how to make select element 'remember' previous value

Posted on 2011-09-19
2
389 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Report: Liquid Web beats Amazon, Rackspace & More

A study by performance analyst firm Cloud Spectator finds that Liquid Web beats rivals Amazon, Rackspace and DigitalOcean when it comes to website and cloud application performance.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Node.js 11 71
Link failure 16 86
Why "Mobile First"? 5 60
change site header 8 27
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

738 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