ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> ruby-talk
ruby-talk
Form_remote_tag and csv download?
by Chris Kujawa other posts by this author
May 9 2008 7:37AM messages near this date
Re: Which GUI library to use? | Download resume with NET::HTTP
Good morning!  I have a case where I need to build a csv file from my
model and allow a user to download/save that file.  I've got this all
working with non-Ajax forms, but the generation of the csv file can take
quite a bit of time, so I want to provide a busy indicator for my user.
So I tried the following in my view:

<% form_remote_tag ( :url => {:action => 'all_open'},
         :update =>  "test" ,
         :before =>  "Element.show('busy_indicator')",
         :complete =>  "Element.hide('busy_indicator')") do %>
          <%= submit_tag 'Save Report', {:name =>  'save_report'} %>
<% end %> 

which only updates the "test" div, as I expected (but this isn't what I
want since the data is already displayed in a pretty table on the page).
I googled and found suggestions to try send_file, but since I'm building
my csv from a model and don't want to save the file server-side, this
won't work.    I also found http://www.ruby-forum.com/topic/111107, but
I need the busy indicator so user's don't mash the save button
incessantly. Is there any way at all to pop up my busy_indicator and
still start the file download?

Any help/advice would be greatly appreciated (especially if it's
quick...this is the last thing I need to fix before deploying the
app:)).

Thanks in advance!

-Chris
-- 
Posted via http://www.ruby-forum.com/.

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved