I am working with a JSF form on a view *.jspx page that contains approximately 20 fields. The form includes a print preview button that opens a new browser window and displays the form in read-only mode.
To achieve this, I have utilized a workaround involving setting a boolean flag in the Managed bean as showPrintPreview. This method successfully renders all fields as read-only and disables buttons, but I prefer not to modify the backing bean object directly.
My goal is to create a print preview using CSS or JavaScript for a JSF form.
UPDATE:
As an alternative approach, I attempted to use the onclick event on the print preview button to trigger the predefined window.print() JavaScript function. However, this method also displays all buttons. My intention is to hide specific buttons such as submit or back during the print preview, while still showing input fields like text and textarea.