Add a print button to the form

More
10 Dec 2018 14:22 #1 by Demis [Fox-Labs]
Demis [Fox-Labs] created the topic: Add a print button to the form
Let's suppose that you want to let the user print the form as it appears in the browser before submitting.
For that purpose, the File → Print function in user's browser does the trick.
However, some people prefer to add a print button in the form itself.
If this is your case, you can achieve that with a simple HTML field. Add it to the form, and put this HTML code in it:
<p><button type="button" onclick="window.print()">Print this form</button></p>
In case you need also to hide the "Submit" button, add the following line:
<p><button type="button" onclick="window.print()">Print this form</button></p>
<script>jQuery('div.fox-item-submit-fields').hide();</script>

Note that this is highly discouraged for UX matters. Users should use the File → Print menu in their browser instead.
Anyway, the example is still valid to show how you can put your own HTML or JavaScript code into the form with an HTML field.

Please Log in or Create an account to join the conversation.