Update a collection_select with user made field

Posted by Flexo on Stack Overflow See other posts from Stack Overflow or by Flexo
Published on 2010-04-02T08:56:04Z Indexed on 2010/04/02 9:03 UTC
Read the original article Hit count: 126

Filed under:
|

I have a collection_select that i want user to add custom fields to. I have a jQuery script that detects if the row "Custom" is chosen and adds a textfield to the page so the user can enter a custom name.

How can i store that custom made name in the db and update the collection_select?

<%= f.collection_select :kind_id, Kind.find(:all, :order => "created_at DESC"), :id, :name, {:prompt   => "Select a Type" }, {:id => "selector", :onchange => "type_change(this)"} %>

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about dropdownlist