How do you design/setup a signature field - InfoPath Dev
in

InfoPath Dev

How do you design/setup a signature field

Last post 02-15-2006 10:00 PM by uma. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 02-13-2006 04:21 AM

    How do you design/setup a signature field

    Needed some suggestions on how to set up a signature field in a Infopath form. Have a form that a user will fill out then when they click on the Submit button will email form to a individual then they will review and "sign off" on the form and in turn will email to other individuals. Outside of using "Digital Signatures" which is not a option and want to get around having a text field that a user will type in their name. Was trying to set up a "read only" text box that when a user clicks on a "Sign" button, their username or email address will automatically populate the "Read Only" text box.

    Can't seem to come up with the code to perform this function.
    Thanks for any suggestions.
  • 02-13-2006 05:29 AM In reply to

    • uma
    • Top 500 Contributor
    • Joined on 12-23-2005
    • Posts 35

    Re: How do you design/setup a signature field

    Hi,
    Instead of digital signatures use the following procedure to setup a signature field:

    1. Add one text field to your InfoPath form.
    2. To make it as read only go to text box properties->Go to Display tab->Click on Conditional Formating button->click on Add->select the text field name which you want to make read only in the first drop down-> select “is not blank” in the second drop down->and check the “Read only” check box.
    3. Click ok 3 times to close the dialogue boxes.
    4. Get the user name under the button (“named as sign”) Onclick event by using the given code in c# and set it in the text field as following.
    string temp=System.Environment.UserName;
    thisXDocument.DOM.selectSingleNode("my:myFields/my:Personal_info/my:Name").text=temp;
    5. Preview the form and try signing the form through the text field instead of using digital signatures.



    Uma Karnati
    InfoPath Dev India
  • 02-13-2006 09:58 AM In reply to

    Re: How do you design/setup a signature field

    Hi Uma.
    Thanks for your reply. I'm not sure if I was supposed to substitute any field names etc in the code example you provided but The text field name I am wanting to insert the user name into is:
    isso_name. The form name is: it_user_account_access
    The form code for the field isso_name looks like this:


    function isso_sign::OnClick(eventObj)
    {
    // Write your code here
    string temp=System.Environment.UserName;
    thisXDocument.DOM.selectSingleNode("my:myFields/my:Personal_info/my:Name").text=temp;
    }

    When I try to preview my form I get the following error:

    Info Path cannot create a new blank form
    The form template is not valid.

    When I click on "Show Details" I get the following:
    InfoPath cannot open the selected form because of an error in the form's code.
    The following error occurred:

    Expected ';'
    File:script.js
    Line:38
    string temp=System.Environment.UserName;
  • 02-13-2006 09:50 PM In reply to

    • uma
    • Top 500 Contributor
    • Joined on 12-23-2005
    • Posts 35

    Re: How do you design/setup a signature field

    No, It is not necessary to substitute any field name or form name & etc in the code. But It is necessary to give the “xpath” of the test field (“isso_name”) for the “selectSingleNode()” method.

    And I think you followed the code which I mentioned in "C#" and the "xpath" of the text field "Name" which I used in my example. It is wrong.

    You written the code in "jscript" and I hope, you created the "isso_name" field just under the “myFields” (myFields->isso_name) in the data source.Then you have to mention the “xpath” for that field as given below:
    XDocument.DOM.selectSingleNode (“my:myFields/my:isso_name”).text=temp;

    If not, please mention the hierarchy of the “isso_name” field where you created, to know the correct “xpath” of that field.

    Do you have the plan to populate the "isso_name" field with email id? because in Jscript you can't populate the user name. That is "System.Environment.UserName" does not work.

    Note: you have to use "XDocument" instead of "thisXDocument" in the Jscript code.
    thisXDocument is for C#.

    Uma Karnati
    InfoPath Dev India

  • 02-15-2006 11:53 AM In reply to

    Re: How do you design/setup a signature field

    Hi Uma,
    I tried you suggestion and got mixed success. When I'm in design mode and click on the Preview Button your code works and a text field is populated with the username of the user. I emailed a copy of the form to a co-worker to text. When they save the attachement and open up the form, it automatically comes up in the fillout mode. When they click on the "SIGN" button to execute your code, we get the following error messages:
    Infopath cannot complete this action because of a error in the form's code.
    When I click on the button to "Show Detail" the following message is presented:
    The following error occurred:
    Automation serer can't create object
    File: script.js
    Line: 37


    Here is the code associated with the "Submit Button"
    function sign1::OnClick(eventObj)
    {
    var wshShell = new ActiveXObject("Wscript.Shell");
    var wshEnv = wshShell.Environment("Process");
    var username = wshEnv.Item("UserName");
    XDocument.DOM.selectSingleNode("/my:myFields/my:ac_uname").text = username;
    }


    Any thoughts on what might be going on.

    Thanks,
    Jeff
  • 02-15-2006 10:00 PM In reply to

    • uma
    • Top 500 Contributor
    • Joined on 12-23-2005
    • Posts 35

    Re: How do you design/setup a signature field

    Your InfoPath form requires “Full trust” security level to work with WScript ActiveXObject in InfoPath form and as well as to get accessed by others (ie. To whom the form was sent through email) too.

    Uma Karnati
    InfoPath Dev India
Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.