Hi,
I have a form that is being built dynamically with a recordset.
When the user submits the form, it generates a report built from which items the user checked in the form (e.g. it builds a recordset based on which IDs (checkboxes) were selected). I want the report to open in a new window. Here lies the problem.
I can get the report to open in a new window, but it ignores any checkboxes that were selected. The report generates correctly when I target the same window. You can see I'm also checking to make sure at least one checkbox was selected too.
Thanks for any help!
I have a form that is being built dynamically with a recordset.
Code:
<form name='frmReportGen' action='report.asp' method='post'>
<input type='checkbox' name='chkAddToReport' value='" & objRS("ID") & "'>
.
.
.
<input type="submit" value="Generate Report" onclick="validateForm(); return false;">
</form>
When the user submits the form, it generates a report built from which items the user checked in the form (e.g. it builds a recordset based on which IDs (checkboxes) were selected). I want the report to open in a new window. Here lies the problem.
I can get the report to open in a new window, but it ignores any checkboxes that were selected. The report generates correctly when I target the same window. You can see I'm also checking to make sure at least one checkbox was selected too.
Thanks for any help!
Code:
function validateForm() {
var checkFound = false;
for (var counter=0; counter < document.forms['frmReportGen'].length; counter++) {
if (document.forms['frmReportGen'].elements[counter].checked == true) {
checkFound = true;
}
}
if (checkFound != true) {
alert("You must check at least one item before running a report!");
return false;
} else {
document.forms['frmReportGen'].target = 'myRptWin';
var winLeft = (screen.width - 800) / 2;
var winTop = (screen.height - 675) / 2;
windowName = "myRptWin";
var windowFeatures = "width=800,height=675,status,scrollbars,resizable,left=" + winLeft + ",top=" + winTop
newWindow = window.open('report.asp', windowName, windowFeatures);
newWindow.focus();
}
}