Rails combo box

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.

On Mon, 2006-09-18 at 19:09, Mike K. 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-

Project name
<%= @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]} @[email protected](@invoice['project_name']) select(:invoice, :project_name, @projects, { }, {:onkeypress=>"edit(event);", :onblur=>"this.editing=false;"})%>


Sterling Web Services
http://www.websterling.com
The Web Done Right