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/.