Quantcast
Channel: Adobe Community : All Content - ColdFusion
Viewing all articles
Browse latest Browse all 5979

Unable to redirect to calling page after exporting the cfucntion output to excel using cfcontent tag

$
0
0


Hello everyone,

 

I’m trying to export the contents of function output to a excel using the click of a button. I have created a action page for the button, which calls the export to excel standard code using cfheader and cfcontent tag. Exporting the excel using these tags works fine but after the cfcontent tag I have created a form and redirecting it back to the calling page. The code after the cfcontent tag are not executing and page is not redirecting.

 

This is the code i'm using for exporting to excel.

 

<cfsavecontent variable="strExcelData">

<cfoutput>#fn_retrieveData()#</cfoutput>

</cfsavecontent>

<cfheader name="Content-Disposition" value="attachment; filename=Audit_#DateFormat(Now(),'ddmmyyyy')#.xls"/>

<cfcontent type="application/vnd.msexcel" variable="#ToBinary( ToBase64( strExcelData.Trim() ) )#"/>

 

<form name=frm_AuditTrail method=POST action=tchk_AuditTrailSearch.cfm>

<cfoutput>

                <input type='hidden' name='txt_searchstr1' id='txt_searchstr1' value='#FORM.txt_searchstr1#' />

                <input type='hidden' name='txt_searchstr2' id='txt_searchstr2' value='#FORM.txt_searchstr2#' />

               </cfoutput>

</form>

<script type="text/javascript">

                window.onload = function()

                {

                                  alert("windows.onload is redirecting to review data page NOW");

                                  document.frm_AuditTrail.submit();

                                  return;

                }

</script>

 

Thanks.....


Viewing all articles
Browse latest Browse all 5979

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>