AJAX form (using simple_form) with preserved error validation

I know it’s unlikely that anyone will check this link, but here’s hoping

Sorry, too hard to explain without showing the pics.

Abram

Someone provided an answer. FYI

I think you can simplify this by putting your form in a partial (we’ll
call it simple_form), and putting this code in reload.js.erb:

$("#entryform").html("<%= escape_javascript(render :partial =>
‘simple_form’) %>");
I’m not familiar with jQuery’s load method, but I assume it does a
second request. The key with rendering errors is the instance variable
(@brand) you’re using while rendering the form has to be the same one
you tried to save in create, so you can check the errors on it. This
is why you always use render instead of redirect_to when you want to
render errors. If you do a redirect, you start a new request, meaning
@brand is reinitialized. I’m assuming your $(…).load(…) is having
the same issue.