Notes posted by pol
RSS feed
5 thanks
Using a Loading Graphic
If you want to make a little loading graphic, typically you use an animated gif (like a little spinner or something). Both link_to_remote and remote_form_for allow you to easily do this by using the :loaded and :loading triggers to call javascript.
For example:
<% remote_form_for @survey, :loading => "$('loading').show();", :loaded => "$('loading').hide();" do |f| %> <%= submit_tag ' Save' %> <%= image_tag "indicator_circle.gif", :style => 'display: none;', :id => 'loading' %> <% end %>
The ‘loading’ parameter used for the ‘$’ prototype selector is the id of the animated gif. It starts out hidden, and is toggled by the loading/loaded triggers.