I have a page where I do this:

<div id="submitForm">
  <% if current_user.already_done?(@question) %>
      <%= render 'update_info_form' %>
  <% else %>
      <%= render 'create_info_form' %>
  <% end %>
</div>

Which works fine. It checks if the user has already answered a question,
and picks either the creation form or the update form.

However, when I try to switch out this block of html using AJAX, it
won't render the update form. When I look at the page source, I'm just
seeing the form that creates a new record, and it doesn't work properly.

Anyone got any ideas how to do this properly?

My create.js.erb is:
$("#response").html("<p>Answer created.</p>");
$("#submitForm").html("<%=
escape_javascript(render('questions/update_info_form')) %>")

and update is just:
$("#response").html("<p>Answer updated.</p>");

After I've clicked to create a new record, I get the 'answer created'
and on the second click I get 'answer updated' like it should, but it
just updates it with no parameters

-- 
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 rubyonrails-talk+unsubscr...@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/bf846b3075828a56330e184dad586052%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to