i have been using the below code to automatically print out a form on submission but the problem i have encountered is that upon navigating away from the page, the “Submit – And Print” button stops working.
Secondly is there a way to bypass the print dialog on internet explorer/google chrome and allow the form to print automatically and the send the request to the printer automatically? there is also a need to remove all headers and footers from the pages pritned (i.e. internet explorer web page printing defaults).
<html>
<head>
<script language="javascript" type="text/javascript">
function PrintMeSubmitMe()
{
window.print();
SubmitMe();
}
function SubmitMe()
{
document.MyForm.submit();
}
</script>
</head>
<body>
<form name="MyForm" action="somepage.asp" method="post">
<input type="button" value="Submit - No Print" onclick="SubmitMe()"><br />
<input type="button" value="Submit - And Print" onclick="PrintMeSubmitMe(this)"><br />
</form>
</body>
</html>
i have come to realise that the “submit – and print” bug occurs on google chrome only and not internet explorer
On IE you can install a plugin from MeadCo (a UK based company) which includes an embedded object and comprehensive javascript interface to the printer that allows control of almost all aspects of printing. We have been using this solution for many years now and it would probably meet your needs of avoiding the print dialog, managing header/footer, etc.