Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old August 8th, 2007, 08:52 PM
Newbie
 
Join Date: Aug 2007
Posts: 1
Default editable drop-down list

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.
Reply
  #2  
Old July 20th, 2008, 12:58 AM
Newbie
 
Join Date: Jul 2008
Posts: 1
Default

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

Last edited by acoder; July 20th, 2008 at 11:30 AM. Reason: Removed links
Reply
  #3  
Old July 20th, 2008, 11:34 AM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 12,766
Default

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.
Reply
  #4  
Old July 28th, 2008, 04:49 PM
Expert
 
Join Date: May 2007
Posts: 179
Default

As far as I know, Rails doesn't have a combo box. So you might have to use a JavaScript solution.
Reply
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles