Add ":complete => "eval(...)" in form_remote_tag

All,

I was trying to use “form_remote_tag” to submit a form Ajax and also I
want some javascript code generated by the target view being executed
when the Ajax call is complete. I used following code

<%= form_remote_tag(:url => {:action => :create}), :complete =>
“eval(request.responseText)”%>
<%= render :partial => ‘form’ %>
<%= submit_tag ‘Save’ %>
<%= end_form_tag %>

But the for_remote_tag won’t even being rendered, do I miss something
here?

Thanks

anakintang wrote:

All,

I was trying to use “form_remote_tag” to submit a form Ajax and also I
want some javascript code generated by the target view being executed
when the Ajax call is complete. I used following code

<%= form_remote_tag(:url => {:action => :create}), :complete =>
“eval(request.responseText)”%>
<%= render :partial => ‘form’ %>
<%= submit_tag ‘Save’ %>
<%= end_form_tag %>

What version of rails are you using? For rails 1.2+ you should use
<% form_remote_tag %>
and NOT
<%= form_remote_tag %>

My guess is you are on rails 1.1+. Any reason why you are not using 1.2?

What is generated in the html page (View source) for the form?

Chet Sanders wrote:

anakintang wrote:

All,

I was trying to use “form_remote_tag” to submit a form Ajax and also I
want some javascript code generated by the target view being executed
when the Ajax call is complete. I used following code

<%= form_remote_tag(:url => {:action => :create}), :complete =>
“eval(request.responseText)”%>
<%= render :partial => ‘form’ %>
<%= submit_tag ‘Save’ %>
<%= end_form_tag %>

What version of rails are you using? For rails 1.2+ you should use
<% form_remote_tag %>
and NOT
<%= form_remote_tag %>

My guess is you are on rails 1.1+. Any reason why you are not using 1.2?

What is generated in the html page (View source) for the form?

I am using 1.2.3 rails. What is the new syntax? Just take out “=” like
below?

<% form_remote_tag(:url => {:action => :create}), :complete =>
“eval(request.responseText)”%>
<%= render :partial => ‘form’ %>
<%= submit_tag ‘Save’ %>
<% end_form_tag %>

anakintang wrote:

Chet Sanders wrote:

anakintang wrote:

All,

I was trying to use “form_remote_tag” to submit a form Ajax and also I
want some javascript code generated by the target view being executed
when the Ajax call is complete. I used following code

<%= form_remote_tag(:url => {:action => :create}), :complete =>
“eval(request.responseText)”%>
<%= render :partial => ‘form’ %>
<%= submit_tag ‘Save’ %>
<%= end_form_tag %>

What version of rails are you using? For rails 1.2+ you should use
<% form_remote_tag %>
and NOT
<%= form_remote_tag %>

My guess is you are on rails 1.1+. Any reason why you are not using 1.2?

What is generated in the html page (View source) for the form?

I am using 1.2.3 rails. What is the new syntax? Just take out “=” like
below?

<% form_remote_tag(:url => {:action => :create}), :complete =>
“eval(request.responseText)”%>
<%= render :partial => ‘form’ %>
<%= submit_tag ‘Save’ %>
<% end_form_tag %>

Now I changed to use the new syntax and it works fine. Thanks a lot!

<% form_remote_tag(:url => {:action => :create}, :complete =>
“eval(datasets_tab_handler())”) do -%>
<%= render :partial => ‘form’ %>
<%= submit_tag ‘Save’ %>
<% end -%>