I have a form that is based on Demonstration #14, but I have added all sorts of stuff to it, which may or may not have broken the print button in the form. When I click the print button, it takes me to a page that has the form without the skin and container (good), but none of the data gets pulled into the form (bad). I have also added custom javascript for the submit that checks whether the form is being updated or if it's the first submit, and brings up a print dialog only if it's the first submit. I added to that a javascript function that would just write the contents of the module into another window, without page headers and footers, that basically looks like the printer-friendly version that opens when you click the print button. The javascript for that is at the bottom of this post.
I know that I'm going to hear that I should redirect to a page and pull the data from the database, but the problem with that is that I don't want users to submit until after they print, which I want to occur after they make any necessary corrections to the form. The form is designed so that two types of users only have access to the data at different times. After the initial submission by one user type, the data is no longer available to them. The only ones that can edit the data are the users of the second type. I'm not sure that any of this really matters; the module was obviously designed to print before the form is submitted (why else would there be a print button?), so I really just need to troubleshoot why it doesn't do that (I probably broke it with all of the customizations).
Thanks in advance to anyone who can help with this. We're hoping to use this in our live environment this weekend, but I think that we will make do if we can't get this last bit ironed out in time. Javascript follows (the function is the main thing so you can probably disregard the rest), thanks again!
function printSpecial()
{
if (document.getElementById != null)
{
var html = '\n
\n';
html += '\n\n\n\n';
var printReadyElem = document.getElementById("dnn_ctr1217_ContentPane");
if (printReadyElem != null)
{ {
html += printReadyElem.innerHTML;
}
else
{
return;
}
html += '\n\n';
var printWin = window.open("","Call Details");
printWin.document.open();
printWin.document.write(html);
printWin.print();
printWin.document.close();
}
}
var b = "False";
var a = window.location.href;
var myStringList = a.split('&');
var i = 0;
while (i < myStringList.length)
{
if (myStringList
== "DBUpdate=True")
b = "True";
i++;
}
if (b == "False")
{
printSpecial();
}