I have the simplest javascript function in the world:
fnSubmit()
{
window.print();
document.formname.submit();
}
which is called:
<button type="button" id="submit" onclick="fnSubmit()">Submit</button>
Everything is fine and good, the print dialog box appears, however, after printing or canceling printing, I get the following error:
"document.formname.submit is not a function"
My form is defined as follows: (obviously, I am not using the form name in the actual code, but you get the idea)
<form name="formname" id="formname" method="post" action="<?=$_SERVER['SCRIPT_NAME']?>">
Obviously, I'm not trying to do something special here, and I used similar approaches in the past, what am I missing here in the world?
source
share