Re: [Rails] Ajax - the Rails way!
2013/5/30 Tommy Ng <lists@ruby-forum.com>
<% form_tag({:controller => "main", :action => "contact"}, :remote =>
There should be an equal sign (=) just after the percent to tell erb, that it should output something
true, :update => "result") do %>
Name:<br/><%= text_field_tag(:name, :"", :id => "name") %><br/><br/>
Message:<br/><%= text_area_tag(:message, :"", :id => "message")
%><br/>
<%= submit_tag "Send" %>
<% end %>
<div id="result"></div>
First problem, my form now disappeared. It appeared when it was
<%= form_tag("/main/contact", :method => "post", :id => "contactForm")
do %>
Here you have that equal sign, so erb knows to output the formtag, in the line without it, the returnvalue of form_tag is just ommited.
Also there are some nice railscasts about Ajax and a blogpost wich kickstarted me a few weeks ago: http://www.alfajango.com/blog/rails-3-remote-links-and-forms/
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CA%2BbCVssC%3DnoG7XaQLa%2B45ry6rPLN9dc9Czrvquj8q7bP2S4kkQ%40mail.gmail.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home