Skip to main content

We can simply extend the recent release of Nintex Mobile Signature Control to work with desktop/browser. This exercise I will show how I did it combining the blog post Sign your name across my heart from Dan Stoll​ and my previous post on Embedding Signature Pad in Nintex Form.

 

The outcome will be a form supporting the capturing and displaying of Signature on both Nintex Mobile or Desktop form. The Signature data is save as base64 image data in a multi-line of text list column (i.e. "Signature" in this case).

 

Here are the steps I followed:

 

1. Create a custom list for the purpose. We are going to have only two columns defined, one for the Title (i.e. Single line of text), and the second for Signature (i.e. Multiple line of text - Plain Text), as shown here

178449_pastedImage_2.png

2. Customize the List Form with Nintex Form, as shown below. And don't forget to also create a layout for Nintex Mobile Phone if you going enable the Signature capture on Nintex Mobile Application.

178450_pastedImage_3.png

3. We going to set the Signature control with "Client ID JavaScript Name" (i.e. to "jsignature" in my example) as shown below, this is needed as we going to call JavaScript to get the Signature Data and assign it to the Signature Multi Line of Text Form Control.

178454_pastedImage_4.png

4. For the "Save" button of the form, we going to set the "Client Clicked" event to call a JavaScript to assign the Signature data to the Signature form control. Below diagram shows the Button's setting.

178455_pastedImage_5.png

5. I have taken the JavaScript from Dan Stoll​'s post Sign your name across my heart​, and modified it to work with the jSignature library as shared in my previous post Embedding Signature Pad in Nintex Form​, I have changed line 23rd to hide the signatureUI using the CSS instead, and line 38 and 39 to call the jSignature library's Signature control to allow capturing of Signature on the if the form is edited in the desktop browser. The JavaScript function (i.e. setControlValue) is to be called by the Save button to set the Signature base64 data to the Signature (i.e. multi line of text) form control. And, don't forget to also include the jSignature library as mentioned in my previous post Embedding Signature Pad in Nintex Form​.

 

NWF$(document).ready(function() {

// Strings to be translated 

var NoSignatureMessage = 'No signature'; 

var AddSignatureMessage = 'To add a signature please open this form in Nintex Mobile.'; 

// Find all the signature controls. 

NWF$("div.nf-filler-control.data-controlname^='Signature']").add("div.nf-filler-control.data-controlname^='signature']").each(function () { 

    // Find the container element which houses the actual UI the user sees. 

    var signatureUI = NWF$(this).find("div.nf-filler-control-inner");     

    var signatureInputo365ViewMode = NWF$(signatureUI).find("div");     

    var signatureInputo365EditMode = NWF$(signatureUI).find("textarea"); 

    var signatureInputOnPremBothModes = NWF$(signatureUI).find("inputntype=text]"); 

    var signatureContent; 

 

 

    // Get the actual base64 value of the signature. 

    if (signatureInputOnPremBothModes.length != 0) 

        signatureContent = signatureInputOnPremBothModes.val(); 

    else 

        signatureContent = signatureInputo365ViewMode.html(); 

 

 

    // Hide all existing Nintex Forms UI elements. 

    signatureUI.css('visibility', 'hidden');

 

 

    // If not in edit mode then show image 

    if (signatureInputo365EditMode.length == 0 || NWF$(signatureInputOnPremBothModes).is(':disabled')) { 

        if (signatureContent != "") { 

            // Insert the signature image. 

            signatureUI.after("<img id='img' height='" + NWF$(this).height() + "' width='" + NWF$(this).width() + "'  src='data:image/png;base64," + signatureContent + "' />"); 

        } else { 

            // Insert a message saying no signature. 

            signatureUI.after('<div>' + NoSignatureMessage + '</div>');

        } 

    } 

    else { 

        // Insert a message saying its not supported in browser.

        signatureUI.after('<div id="signature"></dv>');

        var sigdata = $('#signature').jSignature();

    } 

});

});

 

function setControlValue(){

  var str = $('#signature').jSignature('getData');

  NWF$('#'+jsignature).val(str.substr(str.indexOf(",") + 1));

}

 

6. With that, we are all done, the form is now capable of capturing and displaying of signature on both Nintex Mobile or Desktop form.

178457_pastedImage_15.png

178458_pastedImage_16.png

Hi Jared,

I didn't tried this on SP 2016, but i find no reason why it won't work...

Get Outlook for iOS<https://aka.ms/o0ukef>


just got it to work.  There was a mistype in my jquery references. 


Hi, I have tried this in Enterprise 2010 and can't seem to get it to work. My multi-line text field just looks like a multi-line text field with a cursor. Anyone else have this issue?


One thing to note with the above code, if no signature is added during the New mode, the field is locked for good. We ran into the problem where a user will partially fill out the form, save, edit and then wish to sign. In this case they will be unable.


I am using SharePoint 2010 and have been unable to get the desktop signature to work. The mobile one works great, and I can view it in desktop mode, but I am not able to add signatures in desktop mode. Using the above code from Wisam, in "Add" mode I get this:

Just a blank "Signature" area but nothing I can do with it.

When I add a signature in Mobile, and then "Edit" the form, here is what I get:

I can't edit the graphic signature at all (note: I have the text of the signature field showing below, just for reference purposes).

My JavaScript Includes are set up like this:

Has anyone been able to get this to work in SharePoint 2010 on prem? Any suggestions greatly appreciated!


Since I was using IE to test this, it occurred to me to try it in Chrome. It worked! Then I went into developer tools (F12) and manually changed the document emulation to 10 and it worked in IE as well. So, it turns out that the problem is that I am using IE11 with SharePoint 2010 so I'm running it in compatibility mode, which makes it look like IE8, so the jSignature library doesn't work.  

I found this solution: How to render a SharePoint page in IE using EDGE mode without changing the master page – paul.tavares  which is a utility that allows you to pass the url of the page you want to load NOT in compatibility mode (like the form with the signature on it, in this case). This page is loaded in an iframe that emulates the current version of IE. This utility works for me for this signature form, so I think my problem is solved. 


Is there anyway to set signature field as a require field?


Can we also get the JavaScript to pass on nintex live forms?


This is great but doesn't work for me in IE11 or Edge but works wonderfully in Chrome & Firefox. 

I have tried to put a button to clear the signature in the event of someone drawing incorrectly.  I have assigned a function to the button clearSignature()

Then in the custom javascript after function setControlValue() have added

function clearSignature() {
          $('#signature').val('');  
}

An error occurs after publishing when the button is pressed: The form is referencing a field that does not exist. Please notify the form designer.

I haven't been able to track a field that doesn't exist and thought it may be jsignature field name.

Anyone come across problems with IE11 & Edge or have a solution to a reset signature button?


Cool! You may also check the JSignature library for all other available functions and features.

Kok Koon Gan (KK) | Technical Evangelist | Mobile: +65 8332 7738 | Office: +65 6407 1059 | @kknintex<https://twitter.com/kknintex> | 8 Marina View Asia Square Tower 1, Level 07-04, Singapore 018960

<https://twitter.com/nintex> <https://www.facebook.com/Nintex> <http://www.linkedin.com/company/nintex> <http://www.youtube.com/nintex>


Of course.  How stupid of me.

Any ideas on IE11 or Edge?  I am testing on a laptop and have created a generic tablet layout.  I am sure it worked last week.


Resolved both issues.

For a reset button create the button as a javascript button and in the client click add $('#signature').jSignature('clear').

Thanks for your help


Andrew, would you be able modify this line of code to include 4 signatures (line 6 of the js above)?  I am not experienced at JS.  My controls are Signature1, Signature2, Signature3 and Signature4

NWF$("div.nf-filler-controlrdata-controlname^='Signature1']").add("div.nf-filler-controlrdata-controlname^='Signature1']").each(function () {    


You should be able to replace it with

NWF$("div.nf-filler-control[data-controlname^='Signature1']").add("div.nf-filler-control[data-controlname^='Signature2']").add("div.nf-filler-control[data-controlname^='Signature3']").add("div.nf-filler-control[data-controlname^='Signature4']").each(function () {


Hi Andrew, I'm having the same issue where I need 4 signatures. I named my controls Signature1, Signature2, Signature3 and Signature4 and used your bit of JavaScript. When I publish and run the form I'm only able to write on Signature1. I tried making the Client ID JavaScript variable name unique to each control that requires a signature but that does not work either. Could you help me get this to work? Thank you.


Make sure you change the JS code in all the appropriate places. Such as line 6 in the original post should have all the new names, but lines 38,39, 45 & 46


Thank you for getting back to me. I have very little experience using JavaScript so I apologize for my questions. I already have line 6 changed to include the .add() function, but I do not see where else I have to add that line of code. Here is a screenshot of my JavaScript.


I finally got it to work. I don't know if my issue came about because I'm on SharePoint 2010, but I ended up having to repeat a section for each individually named control. It was important to list them out in reverse order than they appeared on the list for it to work at all (this was odd to me). I had to repeat the code in the red box for each named control (Signature1, Signature2, etc.). Remember to change the highlighted sections to the name of your controls if you are using this method.


Any way of implementing this in the responsive form (the code by Wisam Fawzi) as a "in-the-box" solution for signatures on responsive forms? 


If you referring to the recent released of responsive form designer by Nintex, the answer is no as what was introduce here for the signature is by javascript which is not supported by the responsive form.


all good i ended up going back to the classic form.


Steven added this to UserVoice! Please vote

"in-the-box" solution for signatures on responsive forms? – Customer Feedback for Nintex 


got it sorted using classic forms


Hey folks! This seems like the place to ask ... anyone figure out how to pull out a sig from the form & put it into a Document Generation file? That's a requirement I have at the moment...


interesting requirement. the signature control saved the drawing of signature as base64 image, feels like u might need to convert it to image for showing in Word. Office 365 word now supports new method of insertimagefrombase64, but i couldn't figure out if you can do anything from within a workflow, or maybe can invoke a web service call to do so?

Get Outlook for iOS<https://aka.ms/o0ukef>


Reply