Capturing the contents of input boxes
I am using the following code to dump the html code of a dynamic web page to a variable. I post the contents of the variable to the server and then using php, write the contents of the variable to a file. Later I append the header tag info specifing the style sheets used and then use wkhtmltopdf to convert the html file to a pdf file.
var el = document.getElementById("html");
el.value = document.getElementById("htmlPDF").innerHTML;
<form id="innerForm" method="post" action="testPDF.php" target="_new">
<input type="text" id="html" name="html" style="display:none" />
<input type="button" value=">>>Print PDF" onclick="submitForm()" />
Everthing works perfectly except that some input text boxes are filled in with a javascrpt function. Because the 'value' of the box isn't in the value="###" attribute of the input tag, it doesn't get dumped to the file.
My awkward solution is to first post the form, save the values as session variables and then when the page is written again, I can use the session variables to write the 'values' into the value="##" of the input tag. Don't want to do that unless absolutely necessary.......
Am I missing something? Thanks