Bruce Balmer
2006-Jan-22 05:00 UTC
[Rails] Is there a way to add items from the bottom of a drop down list
I am writing a banking / accounting / bookkeeping system for myself. I have orgs (who pay me or who I pay) and line_items (day to day transactions that mirror the entries on my bank statements) On my line_items screen I have a select box with various orgs in it. I''d like to have a way to add an org write there on that screen rather than have to leave it and go back to the orgs screen, add it there and return. Is that possible from within a select box? If so, how? Thanks in advance, bruce
Bob Silva
2006-Jan-22 07:13 UTC
[Rails] Is there a way to add items from the bottom of a drop downlist
Using the AJAX features in Rails, you can accomplish what you want. You will need a text_field to name the new org and a button to trigger the remote function. Once you make the remote function, you have can rewrite the container the select box is in with the new select box with the new org included. Read the Javascript Helper docs in Rails to piece it together. Hope this gets you started. I''ve only been using rails for 3 days, so I can''t write example code for you (yet). Bob Silva> -----Original Message----- > From: rails-bounces@lists.rubyonrails.org [mailto:rails- > bounces@lists.rubyonrails.org] On Behalf Of Bruce Balmer > Sent: Saturday, January 21, 2006 9:00 PM > To: rails@lists.rubyonrails.org > Subject: [Rails] Is there a way to add items from the bottom of a drop > downlist > > I am writing a banking / accounting / bookkeeping system for myself. > I have orgs (who pay me or who I pay) and line_items (day to day > transactions that mirror the entries on my bank statements) > > On my line_items screen I have a select box with various orgs in it. > I''d like to have a way to add an org write there on that screen > rather than have to leave it and go back to the orgs screen, add it > there and return. > > Is that possible from within a select box? If so, how? > > Thanks in advance, > > bruce > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Jonathan Viney
2006-Jan-22 11:23 UTC
[Rails] Re: Is there a way to add items from the bottom of a drop do
Check out the widgets in scriptaculous, see http://wiki.script.aculo.us/scriptaculous/show/Autocompletion for demos. The auto completing text box may be what you''re after, but not if you''re using the select box to select an id. The approach Bob suggested should work. You would just have a little form on your page somewhere which created a new organisation and rendered back the updated select box. -Jonny. bruce balmer wrote:> I am writing a banking / accounting / bookkeeping system for myself. > I have orgs (who pay me or who I pay) and line_items (day to day > transactions that mirror the entries on my bank statements) > > On my line_items screen I have a select box with various orgs in it. > I''d like to have a way to add an org write there on that screen > rather than have to leave it and go back to the orgs screen, add it > there and return. > > Is that possible from within a select box? If so, how? > > Thanks in advance, > > bruce-- Posted via http://www.ruby-forum.com/.