Auto generator for signature Pad picture. - InfoPath Dev
in

InfoPath Dev

Auto generator for signature Pad picture.

Last post 07-10-2006 07:52 PM by Matt Faus. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 06-15-2006 07:44 AM

    • Jedi2002
    • Not Ranked
    • Joined on 05-03-2005
    • Bahamas
    • Posts 4

    Auto generator for signature Pad picture.

    I created a Patient Information Form with a field to take signatures from a signature pad (Sig Plus).
    I got the form to work with the signature pad but what happens is the picture image is only good until a new Patient Information Form is filled out. Reason being is because I had to create a location where the signature would be stored (as a picture) so that info path can retreive it in the form in the correct feild from that location. As a result when a new form is filled out the old sinatures are replaced with the new. because of the code.

    Is there and way i can generate the name of the picture so it can be different every time it is called so i can still have the old signatures when i go back and look at an old form?

    Here is the code I used:

    /*
    * This file contains functions for data validation and form-level events.
    * Because the functions are referenced in the form definition (.xsf) file,
    * it is recommended that you do not modify the name of the function,
    * or the name and number of arguments.
    *
    */

    // The following line is created by Microsoft Office InfoPath to define the prefixes
    // for all the known namespaces in the main XML data file.
    // Any modification to the form files made outside of InfoPath
    // will not be automatically updated.
    //<namespacesDefinition>
    XDocument.DOM.setProperty("SelectionNamespaces", 'xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-05-30T23:54:07"');
    var sigObj = new ActiveXObject("SIGPLUS.SigPlusCtrl.1");
    //</namespacesDefinition>


    //=======
    // The following function handler is created by Microsoft Office InfoPath.
    // Do not modify the name of the function, or the name and number of arguments.
    //=======
    function CTRL1_5::OnClick(eventObj)
    {
    sigObj.InitSigPlus();
    sigObj.OpaqueMode=true;
    sigObj.TabletState=1;
    }

    //=======
    // The following function handler is created by Microsoft Office InfoPath.
    // Do not modify the name of the function, or the name and number of arguments.
    //=======
    function CTRL2_5::OnClick(eventObj)
    {
    sigObj.TabletState=0;
    sigObj.ImageFileFormat=4;
    sigObj.ImageXSize=200;
    sigObj.ImageYSize=75;
    sigObj.ImagePenWidth=11;
    sigObj.JustifyMode=5;
    sigObj.WriteImageFile("M:\\sigim\SigImage1.JPG");
    var objField1 = XDocument.DOM.selectSingleNode("//my:myFields/my:field1");
    objField1.text = "M:\\sigim\SigImage1.JPG";
    }

    //=======
    // The following function handler is created by Microsoft Office InfoPath.
    // Do not modify the name of the function, or the name and number of arguments.
    //=======
    function CTRL105_5::OnClick(eventObj)
    {
    sigObj.InitSigPlus();
    sigObj.OpaqueMode=true;
    sigObj.TabletState=1;
    }

    //=======
    // The following function handler is created by Microsoft Office InfoPath.
    // Do not modify the name of the function, or the name and number of arguments.
    //=======
    function CTRL106_5::OnClick(eventObj)
    {
    sigObj.TabletState=0;
    sigObj.ImageFileFormat=4;
    sigObj.ImageXSize=200;
    sigObj.ImageYSize=75;
    sigObj.ImagePenWidth=11;
    sigObj.JustifyMode=5;
    sigObj.WriteImageFile("M:\\sigim\SigImage2.JPG");
    var objField100 = XDocument.DOM.selectSingleNode("//my:myFields/my:field100");
    objField100.text = "M:\\sigim\SigImage2.JPG";
    }

    //=======
    // The following function handler is created by Microsoft Office InfoPath.
    // Do not modify the name of the function, or the name and number of arguments.
    //=======
    function CTRL107_5::OnClick(eventObj)
    {
    sigObj.InitSigPlus();
    sigObj.OpaqueMode=true;
    sigObj.TabletState=1;
    }

    //=======
    // The following function handler is created by Microsoft Office InfoPath.
    // Do not modify the name of the function, or the name and number of arguments.
    //=======
    function CTRL108_5::OnClick(eventObj)
    {
    sigObj.TabletState=0;
    sigObj.ImageFileFormat=4;
    sigObj.ImageXSize=200;
    sigObj.ImageYSize=75;
    sigObj.ImagePenWidth=11;
    sigObj.JustifyMode=5;
    sigObj.WriteImageFile("M:\\sigim\SigImage3.JPG");
    var objField101 = XDocument.DOM.selectSingleNode("//my:myFields/my:field101");
    objField101.text = "M:\\sigim\SigImage3.JPG";
    }

    //=======
    // The following function handler is created by Microsoft Office InfoPath.
    // Do not modify the name of the function, or the name and number of arguments.
    //=======
    function CTRL109_5::OnClick(eventObj)
    {
    sigObj.InitSigPlus();
    sigObj.OpaqueMode=true;
    sigObj.TabletState=1;
    }

    //=======
    // The following function handler is created by Microsoft Office InfoPath.
    // Do not modify the name of the function, or the name and number of arguments.
    //=======
    function CTRL110_5::OnClick(eventObj)
    {
    sigObj.TabletState=0;
    sigObj.ImageFileFormat=4;
    sigObj.ImageXSize=200;
    sigObj.ImageYSize=75;
    sigObj.ImagePenWidth=11;
    sigObj.JustifyMode=5;
    sigObj.WriteImageFile("M:\\sigim\SigImage4.JPG");
    var objField102 = XDocument.DOM.selectSingleNode("//my:myFields/my:field102");
    objField102.text = "M:\\sigim\SigImage4.JPG";
    }

    ____________________________________________________________________
    BELOW YOU WILL FIND A LINK TO SEE A PIC OF HOW THE FORM LOOK.

    http://meddentco.com/PIF.jpg





  • 07-10-2006 07:52 PM In reply to

    Re: Auto generator for signature Pad picture.

    Oh man, yeah you definitely want to use a repeating structure here. Writing that code over and over again is horrible. You will also want to store the actual Base64 data into the form, not a link.

    1. Make the schema repeating. This is very important
    2. Double-click whatever node the picture control is bound to, change the data type to base64Binary
    3. Put in a repeating section with all of the nodes that you want.

    You will probably also wnat to delete all of the nodes that are not in the repeating group so that you have a pure schema. You might even just want to start a new form from scratch and do a lot of copy+pasting so you don't have to bother with such huge schema edits. I hope this helps and let us know how things turn out! I think you will realize that things will be MUCH easier once you have a repeating schema, and then when you store the image as base64 you won't have to worry about the filename.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.