Forum: Ruby on Rails Problem with select_tag

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A3ae9f39c4b2fd0fa048bfa43ca2a495?d=identicon&s=25 Thiti Panya (plemazako)
on 2009-02-27 04:00
i create drop-down memu for organelle by using select_tag but problem is
can't get value for form to database  seqfeature, i don't understand
why? pls help me

code for veiw.rhtm
<% form_for :seqfeature do |form| %>
A3ae9f39c4b2fd0fa048bfa43ca2a495?d=identicon&s=25 Thiti Panya (plemazako)
on 2009-02-27 04:09
Thiti Panya wrote:
 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| %>
  <div class="form_row">
        <label for="seq_name">Sequence Name :</label>
        <%= form.text_field :seq_name %>
  </div>

  <div class="form_row">
        <label for="organelle">Organelle </label>
        <%= select_tag "organelle" , options_for_select(["",
"mitochondrion", "nucleomorph", "plastid", "mitochondrion: kinetoplast",
"plastid: chloroplast", "plastid: apicoplast", "plastid: chromoplast",
"plastid: cyanelle", "plastid: leucoplast", "plastid: protoplastid" ])
%>
  </div>
<%= 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
This topic is locked and can not be replied to.