# Best way to add new items to a select?

**URL:** <https://www.ruby-forum.com/t/best-way-to-add-new-items-to-a-select/103931>\
**Category:** Rails\
**Created:** [May 11, 2007, 7:16pm UTC](https://www.ruby-forum.com/t/best-way-to-add-new-items-to-a-select/103931 "2007-05-11T19:16:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![patcito](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/50afbb/32.png) [@patcito](https://www.ruby-forum.com/u/patcito)\
**Post date:** [May 11, 2007, 7:16pm UTC](https://www.ruby-forum.com/t/best-way-to-add-new-items-to-a-select/103931/1 "2007-05-11T19:16:03Z")

</div>

hey all,  
I have a select tag like this:

\<%= select ‘movie’,‘director\_id’,Director.find(:all).collect {|x|  
[x.name, x.id]} %\>

I would like to add a new director in case it’s missing from the  
select. I would like to do this the Ajax way maybe with a  
in\_place\_select? or by putting an rjs link that replace the select  
with a textfield and a button but I’m not sure maybe there’s a better  
way.  
I also like how they do it in google mail, where the last option of  
the select is a “create a new label”, then if I click on that option  
in the select it popups a dialog and then updates the select.

Any ideas or links to demo?

thanx in advance

Pat
