472,127 Members | 2,052 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,127 software developers and data experts.

editable drop-down list


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 10325
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
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
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
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.