This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

Print Button


  1. Lunbag
    Member

    I would like to be able to add a print button on the form.
    I have a few form so i only want the button on one of them so i would like the option of adding it when i like.
    Can anyone help me?

    Posted 14 years ago #
  2. Plastic
    Pro Member

    You can try placing this entire code in the box of a Section Break on your form. The button should appear when you view the form.

    <script Language="Javascript">
    function printit(){
    if (window.print) {
    window.print() ;
    } else {
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
    document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
    WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box WebBrowser1.outerHTML = "";
    }
    }
    </script>
    <script Language="Javascript">
    var NS = (navigator.appName == "Netscape");
    var VERSION = parseInt(navigator.appVersion);
    if (VERSION > 3) {
    document.write('<form><input type=button value="Print Completed Form" name="Print" onClick="printit()"></form>');
    }
    </script>

    Posted 14 years ago #
  3. Plastic
    Pro Member

    Oooppss! Looks like the Section Break won't accept that code. But you could still place that code on the web page that holds your form.

    Posted 14 years ago #
  4. Plastic
    Pro Member

    Also, you CAN use the section break field if you want to put a text version of "Print This Form". Just add the following line to the section break box:
    PRINT THIS FORM

    To make this work you must first enter the code. Then go to the < at the beginning of the code and remove it. Then put it back again. That will make the PRINT THIS FORM text visible on your form.

    You can see a sample of this at: http://www.super-up.com/machform/view.php?id=3

    Posted 14 years ago #

RSS feed for this topic

Reply