How was this implemented?
Do you have a data label control where the 'Literal' Property is enabled, and the Prevent XSS is disabled?
Are you setting the data label with the script as the value?
Or do you have the <script>window.print();</script> defined in a expression, and the mapping the expression to the data label with the settings described above?
You can also do a:
when form is initialized
- set property control of the data label described above, setting the expression to the expression with the '<script>window.print();</script>' defined, this may ensure that the print windows will load after the form has fully loaded
There is a data label set:
Text/JavaScript script type="$" (document).
prepared (function() $("[title='Action Button']").
function() "window.print()");;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Now it operates. However, I would like to hide the "print" button that appears when trying to print. The following rule was I made:
"When the button print is clicked, the button print form control is hidden."
but it is unsuccessful.
Maybe the print() JavaScript executed before Smartforms hide button rule did.
You can try creating an expression, and adding the '<script>window.print();</script>' to that expression. Then clear out your data label but just keep the 'Literal' Property as enabled, and the Prevent XSS as disabled.
Then:
"when button print is clicked
them hide the button print form control
set button print control's properties (set the expression to the one containing '<script>window.print();</script>')"
It worked. Thak you!