5.8 Printing Forms

You can add a Print button to a request form by using JavaScript.

HINT:Approval forms automatically contain a Print button.

To add the ability to print a request form, add the URL to the JavaScript library PrintForm.js. The library is located in the User Application WAR at this URL: ./javascript/JUICE/form/PrintForm.js. Two techniques for including a print button are described below:

  • To display a print preview popup when submitting a request form (after data is validated), add the following to the form onload event:

    form.interceptAction("SubmitAction", "around",
          function (invocation)
            {var pf = new PrintForm("SubmitAction");
           } );
  • To add a Print button next to one of the fields on your form, add the following script to the field’s onload event:

    var ctrl = JUICE.UICtrlUtil.getControl(field.getName());
    var btn = JUICE.UICtrlUtil.addButton(ctrl, "printid", "Print",    "Print", "javascript:var p = new PrintForm();