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| %> -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
plebaba-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2009-Feb-27 03:19 UTC
Problem with select_tag
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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
i guess the select tag should be represented as form.select_tag --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
vimal wrote:> i guess the select tag should be represented as form.select_tagthank a lot but i used it , i have error this this undefined method `select_tag'' for #<ActionView::Helpers::FormBuilder:0xb788a2a4> -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
use it as a symbol :organelle rather than as a string "organelle" make sure the :organelle field is made available in ur model seqfeature --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
I am a little busy for better understanding http://guides.rails.info/form_helpers.html --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
thank you very much ,i can fix it -__- 2009/2/27 Sijo Kg <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>> > 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 > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---