Hello all I''m building a form that is not based on a model. The action I want to happen when I click submit is defined in my controller. Here''s the form code in the html.erb <% form_tag ''/gevents/dotheformstuff/'' do -%> <div>Username: <%= text_field_tag("username", "", :size => 40) %></ div> <div>Password: <%= password_field_tag("password", "", :size => 40) %></ div> <div><%= submit_tag ''Find'' %></div> <% end -%> Is this the best way to proceed, with now me editing my routes file so that /gevents/dotheformstuff/ get''s thrown to a controller and action of my choosing? I''ve been reading about using the form_tag like this <%= form_tag :action => "create" %> But my rails is not liking the end_form_tag when I use that. This might be pre rails 2 code, can someone verify? It does seem a lot neater to describe the action in the form_tag rather than edit routes.rb though. Also, when I do send the data back to the controller, how do I go about extracting it? I''m not sure of the syntax needed. Any advice, greatly appreciated. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Apr 17, 8:28 am, vanderkerkoff <tonm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello all > > > I''ve been reading about using the form_tag like this > > <%= form_tag :action => "create" %> > > But my rails is not liking the end_form_tag when I use that. This > might be pre rails 2 code, can someone verify?That is indeed pre rails 2 (and deprecated in 1.2)> > It does seem a lot neater to describe the action in the form_tag > rather than edit routes.rb though.You''re conflating to things. What''s deprecated is end_form_tag (ie the non block form of form_tag). You can of course do <% form_tag :action => "create" do %> ... <% end %>> > Also, when I do send the data back to the controller, how do I go > about extracting it? I''m not sure of the syntax needed. >It just in your params hash. Fred --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> > It does seem a lot neater to describe the action in the form_tag > > rather than edit routes.rb though. > > You''re conflating to things. What''s deprecated is end_form_tag (ie the > non block form of form_tag). You can of course doAck, brain still asleep. That should of course say "conflating two things" --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick, thanks for clearing that up. It''s a bit tricky out there at them moment with so many sites showing help on rails prior to 2. We''ll get there though :-) Thanks again. On Apr 17, 9:03 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > It does seem a lot neater to describe the action in the form_tag > > > rather than edit routes.rb though. > > > You''re conflating to things. What''s deprecated is end_form_tag (ie the > > non block form of form_tag). You can of course do > > Ack, brain still asleep. That should of course say "conflating two > things"--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick, I''m having a doozy of a time finding out how to create a parameters hash out of those two fields when I''m using form_tag You couldn''t point me in the right direction anyone? Rails 2, Creating a Parameters Hash in a form using form_tag. Can''t find anything easy enough for my diseased brain --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 17 Apr 2008, at 10:12, vanderkerkoff wrote:> > Frederick, I''m having a doozy of a time finding out how to create a > parameters hash out of those two fields when I''m using form_tag > > You couldn''t point me in the right direction anyone? > > Rails 2, Creating a Parameters Hash in a form using form_tag. >I''m not sure I understand the problem. You will get the params hash in your controller without having to do anything. Fred --~--~---------~--~----~------------~-------~--~----~ 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''m not sure how to access the params hash in the controller as I don''t know how to refer to it. Here''s the form in the view <% form_tag :action => "getcals" -%> <div>Username: <%= text_field_tag("username", "", :size => 40) %></ div> <div>Password: <%= password_field_tag("password", "", :size => 40) %></ div> <div><%= submit_tag ''getcals'' %></div> <% end -%> How would I refer to the params hash of that in the controller getcals? Thanks for helping Frederick On Apr 17, 10:28 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 17 Apr 2008, at 10:12, vanderkerkoff wrote: > > > > > Frederick, I''m having a doozy of a time finding out how to create a > > parameters hash out of those two fields when I''m using form_tag > > > You couldn''t point me in the right direction anyone? > > > Rails 2, Creating a Parameters Hash in a form using form_tag. > > I''m not sure I understand the problem. You will get the params hash in > your controller without having to do anything. > > Fred--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
woops, missed a do <% form_tag :action => "getcals" do -%> <div>Username: <%= text_field_tag("username", "", :size => 40) %></ div> <div>Password: <%= password_field_tag("password", "", :size => 40) %></ div> <div><%= submit_tag ''getcals'' %></div> <% end -%> --~--~---------~--~----~------------~-------~--~----~ 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 confused. Don''t you just go: params[:username] params[:password] in the controller and then you get the 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 -~----------~----~----~----~------~----~------~--~---
Frederick, I promise you it''s me who is confused, not yourself. Thanks mate, that''s worked a treat. I can now pass these variables back and forth and do what I want. Thanks again. On Apr 17, 10:44 am, Nathan Esquenazi <rails-mailing-l...@andreas- s.net> wrote:> I am confused. Don''t you just go: > > params[:username] > params[:password] > > in the controller and then you get the value? > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---