I find the Rails online documentation at
"http://guides.rubyonrails.org/form_helpers.html#dealing-with-ajax";
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.

-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/0689aefa55a2daa6b2c0c385818b3995%40ruby-forum.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to