I have a php page with 3 different forms. I create 3 separate print buttons with each form.
Now I need to print the filled form before submitting.The form is printing successfully but with out data (with empty fields). I try below code. Please tell me where I am wrong
// my code
<script src="jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="jquery.jqprint.0.3.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
$(function() {
$("#PrintVocab").click( function() {
$('#divToPrint').jqprint();
return false;
});
});
</script>
// print button
<input id="PrintVocab" value="Print" type="image" src="images/print.jpg">
// specific form1
<div id="divToPrint">
<input name="name" type="text" style="border:2px solid #F00;" >
</div>
when I give default value to input like below code then it print that value with form successfully.
<input name="name" type="text" style="border:2px solid #F00;" value="my name" >
I think what might be happening here is that when the form is printed (if by printed you mean printing to a PDF or to paper) it bases itself on the HTML source code at render time. I could be wrong though.
Why do you need to print the form before submission anyway?
The form is yet to be processed and if that processing fails then the printed version is surely wasted. All the systems I have seen where printing is available/required show the results after the form has been submitted. A processing complete page is a much better place to allow the option of printing.
I hope I haven’t completely misunderstood your question.