I find the Rails online documentation at "Action View Form Helpers — Ruby on Rails Guides; difficult to follow, due to the way the information is organized. For example, I wanted to look for Ajax, so I looked under "View". But, because the material is organized in the MVC format, I can always see half of the solution, and not an entire one. I don't know if anyone experienced the same thing.
Back to Ajax, under View, I can see how the form is formed. But, what is missing is what happened after the form is submitted. Ajax is about interacting between client side and server side. I realized that I had to look under "Controller" for the other half of the solution, especially how Rails renders the result before going back to the client side. Long story short, here I have a simple form:
<% form_tag({:controller => "main", :action => "contact"}, :remote => 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 %>
What's wrong with the above code ?
Actually, what I really wanted to ask is more on the server side for this code to work:
def contact ... end
Anyway, one problem at a time. Thanks so much.