On Mon, 2006-09-18 at 19:09, Mike Kogan wrote:> I need an editable combo box for a rails app where I can select from a
> list of values from the DB or have the user input a new one. Doing a
> plain old list box with options from the DB is easy. Can someone please
> direct me to info on the best way to do this? Will I need to resort to
> JavaScript to get it done?
> Thanks in advance.
I don''t think there''s a way to do it without Javascript.
I''ve used the one at
http://www.xaprb.com/blog/2005/09/29/javascript-combo-box/
And then used this in the form-
<td><label for="invoice_project_name">Project
name</label><br/>
<%= @projects=Invoice.find_by_sql(["select distinct project_name from
invoices where client = ? order by
project_name",@invoice[''client'']]).map {|u|
[u.project_name,
u.project_name]}
@projects=@projects.unshift(@invoice[''project_name''])
select(:invoice, :project_name, @projects, { },
{:onkeypress=>"edit(event);",
:onblur=>"this.editing=false;"})%></td>
--
Sterling Web Services
http://www.websterling.com
The Web Done Right
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---