# Drop down list problem!

**URL:** <https://www.ruby-forum.com/t/drop-down-list-problem/196509>\
**Category:** Rails\
**Created:** [November 6, 2007, 12:53pm UTC](https://www.ruby-forum.com/t/drop-down-list-problem/196509 "2007-11-06T12:53:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![subhash](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/47e85d/32.png) [@subhash](https://www.ruby-forum.com/u/subhash)\
**Post date:** [November 6, 2007, 12:53pm UTC](https://www.ruby-forum.com/t/drop-down-list-problem/196509/1 "2007-11-06T12:53:06Z")

</div>

I am using a drop down box in a form, the method is GET. The data  
that  
i am selecting in the box is not getting stored in the database. But  
when i am not using the drop down box the rest of the data is getting  
stored. I stored the submitted form data in an instance variable.  
When  
i am trying to print the instance variable no output is coming…  
Can anybody tell how to get the selected data in the drop down box in  
the other form?

---

<div class="post-metadata">

**Author:** ![subhash](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/47e85d/32.png) [@subhash](https://www.ruby-forum.com/u/subhash)\
**Post date:** [November 6, 2007, 12:58pm UTC](https://www.ruby-forum.com/t/drop-down-list-problem/196509/2 "2007-11-06T12:58:30Z")

</div>

Subhash wrote:

> I am using a drop down box in a form, the method is GET. The data  
> that  
> i am selecting in the box is not getting stored in the database. But  
> when i am not using the drop down box the rest of the data is getting  
> stored. I stored the submitted form data in an instance variable.  
> When  
> i am trying to print the instance variable no output is coming…  
> Can anybody tell how to get the selected data in the drop down box in  
> the other form?

Can you post some code?

Cheers

---

<div class="post-metadata">

**Author:** ![subhash](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/47e85d/32.png) [@subhash](https://www.ruby-forum.com/u/subhash)\
**Post date:** [November 6, 2007, 1:01pm UTC](https://www.ruby-forum.com/t/drop-down-list-problem/196509/3 "2007-11-06T13:01:55Z")

</div>

On 6 Nov 2007, at 11:58, Rajeev K. wrote:

> > the other form?
> 
> Can you post some code?  
> ditto. Also, it’s the 4th time you’ve asked this question today. once  
> is enough.

Fred

---

<div class="post-metadata">

**Author:** ![subhash](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/47e85d/32.png) [@subhash](https://www.ruby-forum.com/u/subhash)\
**Post date:** [November 12, 2007, 10:13am UTC](https://www.ruby-forum.com/t/drop-down-list-problem/196509/4 "2007-11-12T10:13:41Z")

</div>

This is the code that i have written in the view form:

Service  
\<%= select\_tag 'employee', options\_for\_select(%w{None ITS RDS Corporate},"None") %\>

And the code in the controller is:

1. New employee creation:

def create  
@employee = Employee.new(params[:employee])  
if @employee.save  
flash[:notice] = ‘Employee was successfully created.’  
redirect\_to :action =\> ‘list’  
else  
render :action =\> ‘new’  
end  
end

1. Updatation:

def update  
@employee = Employee.find(params[:id])  
if @employee.update\_attributes(params[:employee])  
flash[:notice] = ‘Employee was successfully updated.’  
redirect\_to :action =\> ‘show’, :id =\> @employee  
else  
render :action =\> ‘edit’  
end  
end

On Nov 6, 4:58 pm, Rajeev K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
