1 Question: Submit Form to Iframe using Jquery

Question created on Tuesday March 20, 2018

I am trying to load a SSRS report with parameters into IFrame using Jquery. I am using Form target to Iframe to load into Iframe but it open it into new window.

Html Code

<iframe id="SSRSReportIFrame" class="modal-fix-height" ></iframe>
<form id="SSRSParamPostForm" action="" method="post" target="SSRSReportIFrame"></form>

Jquery Code

var paramPostForm = document.getElementById("SSRSParamPostForm");
paramPostForm.action = ReportViewerPath + '?rc:Toolbar=true&rc:Parameters=Collapsed&rs:Command=Execute&' + ReportName;
paramPostForm.target = "SSRSReportIFrame";
postParamValues.forEach(function (param) {
          //Adding paramters values as hidden controls 
});
paramPostForm.submit();

Or some other way to load Parameter SSRS report to load into Iframe except adding parameters into query string.

3
1 answer                              3                         

The form target references the IFrame's name and not id. You need to add a name attribute like below and that should work.

<iframe name="SSRSReportIFrame" id="SSRSReportIFrame" class="modal-fix-height"></iframe>
1
Tuesday March 20, 2018
source posted here