469,366 Members | 2,231 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,366 developers. It's quick & easy.

editable drop-down list

1
Hi,

I would like to have an editable DropDownList in my ruby on rails application. The user should be able to select a value from the list of choices, or type in a new value (in one of the empty options in the list of choices) if no predefined choice is applicable.

I tried the { :include_blank => 'True'} option but it just provides a blank option included with a set of options for the drop-down list. Here is my code:

<%= collection_select(:snapshot_view, :id, SnapshotView.find(:all, :select => 'DISTINCT your_machine_name '),
:your_machine_name , :your_machine_name,{ :include_blank => 'True'}) %>

I tried to find ways to make blank option editable, but may be i am going in the wrong direction.

Any help regarding this topic is greatly appreciated.
Aug 8 '07 #1
3 10171
scsc
1
Maybe you can try the code for COMBOBOX in HTML. It is an Editable DropDown Listbox with any one select option as Editable (like a textbox ) and the rest as readonly. You can find it here: chakrabarty.com/combobox.html
Jul 19 '08 #2
acoder
16,027 Expert Mod 8TB
Welcome to Bytes and thanks for posting.

I've removed the links to your site. Posting multiple links in that manner is not advisable. Please read the posting guidelines.

Your solution is JavaScript based and doesn't really bring Ruby/Rails into the picture, though it is of course solved with JavaScript alone.
Jul 20 '08 #3
improvcornartist
303 Expert 100+
As far as I know, Rails doesn't have a combo box. So you might have to use a JavaScript solution.
Jul 28 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by David Winter | last post: by
4 posts views Thread by Stephan Bour | last post: by
34 posts views Thread by Luke | last post: by
1 post views Thread by planetthoughtful | last post: by
2 posts views Thread by sahista | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.