Problem with select_tag


#1

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


#2

i guess the select tag should be represented as form.select_tag


#3

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


#4

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


#5

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


#6

thank you very much ,i can fix it -__-

2009/2/27 Sijo Kg removed_email_address@domain.invalid


#7

I am a little busy
for better understanding
http://guides.rails.info/form_helpers.html