I want to render a form (fields and includes a submit button) when using link_to_remote -- the form appears via an ajax call.
I'd like that form to behave as any other form would (it's a basic New Active Record) form, nothing fancy.
Upon submit, though, I'd like the original parent page to remain static without refreshing and, instead of the form, the notice (your form has been successfully submitted) in its place.
Current behavior, upon submit, it redirects the entire page.
I put the remote into a method:
<%= do_event_remote(contact_event, event) %>
And here is this helper method:
def do_event_remote(contact, call_or_email_or_letter)
model_name = call_or_email_or_letter.class.name.tableize.singularize
link_to_remote "#{model_name.camelize}",
:url => send("new_contact_#{model_name}_path",
:contact => contact,
:status => 'done',
:"#{model_name}" => call_or_email_or_letter ),
:update => 'remote_event'
end
Thanks...