Git Product home page Git Product logo

lightning-esignature's Introduction

Salesforce Lightning Component - ESignature

The E-Signature lightning component enables the salesforce developers to add e-sinature feature on their web/salesforce1 mobile application. It generates the image data URL string so that you can either save it into the database as one of the table field or save it as PNG file. It also to show the signaure in Read only mode.

How to install ESignature Component

Unmanaged package

How to use the ESignature Component

Step1: add the below html into your container component

<c:ESignature aura:id="signature" minWidth="0.5" maxWidth="1.5" penColor="rgb(0,0,255)"/>

attribute definitions

minWidth (double): minimum width of a line
maxWidth (double): maximum width of a line
penColor (string): pen color, can be 'red', 'blue' or rgb(0,0,0) etc;

Pen dotSize = (minWidth + maxWidth) / 2;

Step2: in your container component, you have save button to save the signature into the backend storage. here is the sample code when the save button is clicked.

onSave: function(component, event){
  var pngDataStringUrl, signature = component.find('signature');
  signature.capture();
  pngDataStringUrl = signagure.get('v.signatureData');
  //call backend API to save the pngDataStringURL
}

How to show readonly esignature

sometime you want to show saved signature on the page. The ESignature has ReadOnly mode so that it show the saved signature.

Step1: copy the below html snnipet to your container component

<c:ESignature aura:id="signature" readOnly="true"/>

Step2: assumed that on init event, you call Web API to get the saved signature png datastring url, you can set attribute as show below:

  onInit: function(component, event){
    var signature = component.find('signature');
    var dataStringUrl = '....you get from web api call';
    signature.set('v.signatureData', dataStringUrl);
  }

We are using the following opensource framework

Signature Pad

We augment this signature pad library to add compressing capability to shake down the size of the generated signature so that you don't need another library to shrink the size.

The Demo Image from salesforce1 mobile simulator

GitHub Logo

lightning-esignature's People

Contributors

david-onehub-dev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

lightning-esignature's Issues

Can't capture signature on Salesforce Mobile App when component is inside an Action

Hi,

Maybe it's just me that I'm implementing this wrong, but I have an issue using this component.

Here's what I have:

The ESignature component
A ESignatureConfiromation container component that calls ESignature
A DataAndSignature container component that calls a CustomerData component and ESignatureConfiromation

I've put DataAndSignature inside an Account action to be printed as a mobile & Lightning action in the Account page layout.

From browser it works just fine. I can open the action, insert the signature, save it, clear it, close the action and insert the signature again without any problem.

From the Salesforce app, it works only the firs time the action is opened and the components are rendered. If I close the action and then open it again, or open it from another Account record, It won't track the signature.

Am I missing something?

Thanks

Issue with step 2

Hi,

I tried to implement step 2 using code below, but got " [signagure is not defined]" error
Can you help? Thanks.

onSave: function(component, event){
var pngDataStringUrl, signature = component.find('signature');
signature.capture();
pngDataStringUrl = signagure.get('v.signatureData');
//call backend API to save the pngDataStringURL
}

Multiple ESignatures On a page not working

Hi,
I have a requirement to have 3 ESignatures on a lightning app. I have created 3 lightning components with one ESignature each. then put these 3 lightning components into a lightning app. Ony the first ESignature is working.

I also tried to put new varible for signatureWrapperID and it is still not working.
Can you help? Thanks.
<aura:attribute name="signatureWrapperID" type="string" default="signatureWrapper"/>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.