Hello,
I''m new to this Ajax thing but it''s perfect for a project of
mine.
But I can''t figure out how to best pass the form data. This is a text
field that should be on every page of my application. In my layout,
the form submission looks like this:
<%= form_remote_tag :update => ''comment'', :url
=> { :controller
=> ''comments'', :action => ''create'' }
%>
<%= text_area ''page'', ''content'',
{:rows => 3, :cols => 40} %>
<%= submit_tag "Send" %>
<%= end_form_tag %>
And in the corresponding controller I have code like this:
def new
@comment = Comment.new
end
def create
@comment = Comment.new(@params[:comment])
if @comment.save
render_text "<div
id=\"comment\">Thanks!</div>"
else
render_action ''new''
end
end
Well, the Ajax part works perfectly, but the form information is not
getting to the ''create'' method. I have a hunch that maybe the
''new''
method above should somehow be in my application controller, but I''m
not sure if that''s correct nor how to approach this.
Could someone please point me in the right direction?
-raymond