editable drop-down list

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anya
    New Member
    • Aug 2007
    • 1

    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_sele ct(:snapshot_vi ew, :id, SnapshotView.fi nd(:all, :select => 'DISTINCT your_machine_na me '),
    :your_machine_n ame , :your_machine_n ame,{ :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.
  • scsc
    New Member
    • Jul 2008
    • 1

    #2
    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; Jul 20 '08, 10:30 AM. Reason: Removed links

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      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.

      Comment

      • improvcornartist
        Recognized Expert Contributor
        • May 2007
        • 303

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

        Comment

        Working...