# Problem with select\_tag

**URL:** <https://www.ruby-forum.com/t/problem-with-select-tag/161552>\
**Category:** Rails\
**Created:** [February 27, 2009, 10:18am UTC](https://www.ruby-forum.com/t/problem-with-select-tag/161552 "2009-02-27T10:18:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ple\_mazako](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/5daacb/32.png) [@ple\_mazako](https://www.ruby-forum.com/u/ple_mazako)\
**Post date:** [February 27, 2009, 10:18am UTC](https://www.ruby-forum.com/t/problem-with-select-tag/161552/1 "2009-02-27T10:18:54Z")

</div>

i create drop-down memu for organelle by using select\_tag but problem  
is  
can’t get value for form select\_tag to database seqfeature but  
form.text\_field ,it’s work , i don’t understand  
why? pls help me  
##############################################################  
code for veiw.rhtm:  
\<% form\_for :seqfeature do |form| %\>

 Sequence Name : \<%= form.text\_field :seq\_name %\> 

 Organelle \<%= select\_tag "organelle" , options\_for\_select(["", "mitochondrion", "nucleomorph", "plastid", "mitochondrion: kinetoplast", "plastid: chloroplast", "plastid: apicoplast", "plastid: chromoplast", "plastid: cyanelle", "plastid: leucoplast", "plastid: protoplastid"]) %\> 
\<%= submit\_tag "Submit !", :class =\> "submit" %\> \<% end %\>

########################################################################  
code for submit controller:

class SubmitController \< ApplicationController  
def view  
if request.post? and params[:seqfeature]  
@seqfeature = Seqfeature.new(params[:seqfeature])  
if @seqfeature.save  
render :text =\> “sequence submitted”  
end  
end  
end  
end

##### the vale from form insert to table seqfeatures but i can’t

get  
value

---

<div class="post-metadata">

**Author:** ![ple\_mazako](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/5daacb/32.png) [@ple\_mazako](https://www.ruby-forum.com/u/ple_mazako)\
**Post date:** [February 27, 2009, 11:16am UTC](https://www.ruby-forum.com/t/problem-with-select-tag/161552/2 "2009-02-27T11:16:32Z")

</div>

i guess the select tag should be represented as form.select\_tag

---

<div class="post-metadata">

**Author:** ![ple\_mazako](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/5daacb/32.png) [@ple\_mazako](https://www.ruby-forum.com/u/ple_mazako)\
**Post date:** [February 27, 2009, 11:27am UTC](https://www.ruby-forum.com/t/problem-with-select-tag/161552/3 "2009-02-27T11:27:54Z")

</div>

vimal wrote:

> i guess the select tag should be represented as form.select\_tag

thank a lot but i used it , i have error this this

undefined method `select\_tag’ for  
#ActionView::Helpers::FormBuilder:0xb788a2a4

---

<div class="post-metadata">

**Author:** ![ple\_mazako](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/5daacb/32.png) [@ple\_mazako](https://www.ruby-forum.com/u/ple_mazako)\
**Post date:** [February 27, 2009, 11:48am UTC](https://www.ruby-forum.com/t/problem-with-select-tag/161552/4 "2009-02-27T11:48:55Z")

</div>

use it as a symbol :organelle rather than as a string “organelle”  
make sure the :organelle field is made available in ur model seqfeature

---

<div class="post-metadata">

**Author:** ![ple\_mazako](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/5daacb/32.png) [@ple\_mazako](https://www.ruby-forum.com/u/ple_mazako)\
**Post date:** [February 27, 2009, 1:35pm UTC](https://www.ruby-forum.com/t/problem-with-select-tag/161552/5 "2009-02-27T13:35:47Z")

</div>

change like

\<%= form.select :organelle, (["",  
“mitochondrion”, “nucleomorph”, “plastid”, “mitochondrion:  
kinetoplast”,  
“plastid: chloroplast”, “plastid: apicoplast”, “plastid:  
chromoplast”,  
“plastid: cyanelle”, “plastid: leucoplast”, “plastid:  
protoplastid” ])  
%\>

```
 and it will submit to the create action of seqfeature controller. 

```

.There you can write the code as in def view

Sijo

---

<div class="post-metadata">

**Author:** ![ple\_mazako](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/5daacb/32.png) [@ple\_mazako](https://www.ruby-forum.com/u/ple_mazako)\
**Post date:** [February 27, 2009, 4:57pm UTC](https://www.ruby-forum.com/t/problem-with-select-tag/161552/6 "2009-02-27T16:57:30Z")

</div>

thank you very much ,i can fix it -\_\_-

2009/2/27 Sijo Kg [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![ple\_mazako](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/5daacb/32.png) [@ple\_mazako](https://www.ruby-forum.com/u/ple_mazako)\
**Post date:** [February 27, 2009, 2:07pm UTC](https://www.ruby-forum.com/t/problem-with-select-tag/161552/7 "2009-02-27T14:07:17Z")

</div>

I am a little busy  
for better understanding

> **[rails.info](http://guides.rails.info/form_helpers.html)**
>
> Ruby on Rails,Rails Tutorial,Ruby Basics,Rails 4,Bar Rails,Rail
