Vaibhav Deshpande
2009-Apr-09 11:26 UTC
Data is not passing from Form to controller actions
How to render the data from form to controller actions? This is my controller:- class ViewController < ApplicationController def index end def new @txt=params[:txt] end end Index Page:- <form method=''post''action=''view/new'' > <input type="text" name="txt"> <input type="submit"> </form> New Page:- <h1>View#new</h1> <p>Find me in app/views/view/new.html.erb</p> <h2>Hello <%= @txt %></h2> <%= link_to ''index'',''index'' %> Error after filling text box and cliking the submit button:- ActionController::InvalidAuthenticityToken in ViewController#new ActionController::InvalidAuthenticityToken RAILS_ROOT: D:/projectNetBean/validation -- 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 -~----------~----~----~----~------~----~------~--~---
It looks like you are not passing the authenticity token Are you using form_for in the view? On Apr 9, 12:26 pm, Vaibhav Deshpande <rails-mailing-l...@andreas- s.net> wrote:> How to render the data from form to controller actions? > > This is my controller:- > > class ViewController < ApplicationController > def index > end > > def new > @txt=params[:txt] > end > > end > > Index Page:- > > <form method=''post''action=''view/new'' > > <input type="text" name="txt"> > <input type="submit"> > </form> > > New Page:- > > <h1>View#new</h1> > <p>Find me in app/views/view/new.html.erb</p> > <h2>Hello <%= @txt %></h2> > <%= link_to ''index'',''index'' %> > > Error after filling text box and cliking the submit button:- > > ActionController::InvalidAuthenticityToken in ViewController#new > ActionController::InvalidAuthenticityToken > RAILS_ROOT: D:/projectNetBean/validation > -- > 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---