notmyprivateemail2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jan-29 13:58 UTC
Drop down list with ability to take a new entry
Hi there! I''d like to build a drop down selection list that allows the user to a) select an alternative from a set of presets b) enter his own alternative if the one he''s looking for is not in the list of presets. What''s the best way of doing that in Rails? alex --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
There are two solutions I can think of: - Put an option "Add new item" in the list together with other existing options. Use javascript to replace the select element with an input box in case this option is selected by the user. - Have a standard input box and an (image) button next to it which would open a fake drop down list - something like those autocomplete things. This way user could either directly type, or click the button and select from the list. The first solution would be easier to do but once user would click on the "Add new item", there would be no way to go back to the list. Anyway, it would be great, if some better Rails developer could create a helper for such a widget. I would be really thankful :) bobes On Jan 29, 2:58 pm, "notmyprivateema...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <notmyprivateema...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi there! > > I''d like to build a drop down selection list that allows the user to > a) select an alternative from a set of presets b) enter his own > alternative if the one he''s looking for is not in the list of presets. > > What''s the best way of doing that in Rails? > > alex--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 1/29/07, bobes <vladimir.tuzinsky-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > There are two solutions I can think of: > - Put an option "Add new item" in the list together with other > existing options. Use javascript to replace the select element with an > input box in case this option is selected by the user. > - Have a standard input box and an (image) button next to it which > would open a fake drop down list - something like those autocomplete > things. This way user could either directly type, or click the button > and select from the list. > > The first solution would be easier to do but once user would click on > the "Add new item", there would be no way to go back to the list.There''s no reason why you need to get rid of the list if the user clicks on "Add new item...". I would keep the list there so that if they select something other than "Add new item...", it hides the text input box and uses the selected value from the drop down menu. Mike --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Yes, you are right. I thought of hiding the select box, once the input field appears but this is possible as well. Anyway, it would be wonderful to have a select box as in Microsoft Access with "not-in- list" event.... On Jan 29, 7:15 pm, "Mike Garey" <random...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 1/29/07, bobes <vladimir.tuzin...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > There are two solutions I can think of: > > - Put an option "Add new item" in the list together with other > > existing options. Use javascript to replace the select element with an > > input box in case this option is selected by the user. > > - Have a standard input box and an (image) button next to it which > > would open a fake drop down list - something like those autocomplete > > things. This way user could either directly type, or click the button > > and select from the list. > > > The first solution would be easier to do but once user would click on > > the "Add new item", there would be no way to go back to the list.There''s no reason why you need to get rid of the list if the user > clicks on "Add new item...". I would keep the list there so that if > they select something other than "Add new item...", it hides the text > input box and uses the selected value from the drop down menu. > > Mike--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---