Problem with spinner image on form_remote_tag

Problem:

View Code:–>

<% form_remote_tag :url =>
get_reports_backend_billing_billing_reports_path,:update => “reports”,
:complete => “Element.hide(’…/images/spinner.gif’)”, :loading =>
“Element.show(’…/images/spinner.gif’)” do %>

Select Status:

<%= select_tag
“status”,options_for_select(Report::STATUS.collect.insert(0,’’)) %>
<%= submit_tag ‘Get Reports’ %>
<% end %>

Controller code:-
def reports
reports = Report.find_reports(params[:status])
@reports = reports.first
if request.post?
render :update do |page|
page.replace_html “reports_table”,:partial => ‘reports’
end
end
end

Here form is working fine when i am selecting status … but when i click
on submit spinner image is not coming …

Suppose if i am using :disable_with in the submit_tag it is giving RJS
error.

Why?
Could any help me!!!

Thanks in advance

what version of rails are you using?

Lorenzo Brito M. wrote in post #983527:

what version of rails are you using?

2.3.5

Colin L. wrote in post #983543:

On 24 February 2011 06:56, Sai B. [email protected] wrote:

render :update do |page| page.replace_html "reports_table",:partial => 'reports' end end end

Here form is working fine when i am selecting status … but when i click
on submit spinner image is not coming …

Install Firebug in Firefox and see whether it throws up any errors
when you click the button.

Colin

Presently firebug is installed in my system. i have already tested it.
it is not throwing any error.
But when i am using :disable_with in submit_button it is throwing RJS
Error on web page … Like below format

try {
Element.update(“reports_table”, "<table class="list">\n <n
RE_PAID\n \n \n NONE\n

\\n \\n NONE\\n \\n \\n \\n \\n \\n 20\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n\\n\");'); throw e }

On 24 February 2011 06:56, Sai B. [email protected] wrote:

render :update do |page| page.replace_html "reports_table",:partial => 'reports' end end end

Here form is working fine when i am selecting status … but when i click
on submit spinner image is not coming …

Install Firebug in Firefox and see whether it throws up any errors
when you click the button.

Colin

On Thu, Feb 24, 2011 at 2:56 PM, Sai B. [email protected] wrote:

<%= select_tag "status",options_for_select(Report::STATUS.collect.insert(0,'')) %> <%= submit_tag 'Get Reports' %> <% end %>

There’s something wrong with your :loading and :complete arguments. I
think
Element.hide and Element.show
expects an element id. change it to

:complete => ‘$(“spinner”).hide();’
:loading => ‘$(“spinner”).show()’

then add this where you like the image to show

image_tag ‘/images/spinner.gif’, :id => ‘spinner’

Thanks in advance
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

Jim ruther Nill wrote in post #983573:

On Thu, Feb 24, 2011 at 2:56 PM, Sai B. [email protected] wrote:

<%= select_tag "status",options_for_select(Report::STATUS.collect.insert(0,'')) %> <%= submit_tag 'Get Reports' %> <% end %>

There’s something wrong with your :loading and :complete arguments. I
think
Element.hide and Element.show
expects an element id. change it to

:complete => ‘$(“spinner”).hide();’
:loading => ‘$(“spinner”).show()’

then add this where you like the image to show

image_tag ‘/images/spinner.gif’, :id => ‘spinner’

Thanks in advance
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

Hi Jim ruther Nill

Thank You For Suggestion

It is working fine with little bit modification

I have place this information in form_remote_tag as

<% form_remote_tag(:url => { :action=>“get_reports” } ,:before =>
“$(‘spinner’).show();”, :complete => ‘$(“spinner”).hide();’) do %>

Here i placed my code…

<% end %>

So Here i am using these
:before => ‘$(“spinner”).show();’,

:complete => ‘$(“spinner”).hide();’)

i have defined a div called below

<%= image_tag "../images/spinner.gif" %>

Now it is working fine …

But if suppose i am using :loading instead of :before it is not showing
spinning image…

Why?
What is the reason?
Ant one Have Any Idea?