The proper way is to pass the input data to the another action which returns the excel file and display a link to that action. You can pass the data by storing it into a session and retrieving it.
On Tuesday, 29 January 2013 16:06:15 UTC-6, Luca Zacchetti wrote: > > Just trying to open the generated excel file on SQLFORM submission > > Il giorno martedì 29 gennaio 2013 22:13:18 UTC+1, Massimo Di Pierro ha > scritto: >> >> I do not understand what you are trying to do. If the form is accepted >> you should probably reload, not return different data. >> >> On Tuesday, 29 January 2013 10:00:56 UTC-6, Luca Zacchetti wrote: >>> >>> Hi everybody, I've a problem and need your help. >>> I have a view which contains many things including an SQLFORM.factory >>> used to set the query for a report generation. >>> The first time I submit the form the report is correctly opened, the >>> second time the page is just reloaded...how can I fix the problem? >>> Here is my code snippet... >>> >>> def index(): >>> form = SQLFORM.factory(...) >>> if form.accepts(request.vars, session): >>> #report generation... >>> response.headers['Content-Type']='application/vnd.ms-excel' >>> response.headers['Content-Disposition']='attachment; >>> filename=%s.xls'%filename >>> response.headers['Content-Title']='%s.xls'%filename >>> return data #otherwise the file isn't opened >>> return locals() >>> >>> Many thanks! >>> >>> -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.