brinley / jSignature

jQuery plugin for adding web signature functionality
http://www.unbolt.net/jSignature
694 stars 529 forks source link

Required validation for signature #102

Closed harikrishna149 closed 8 years ago

harikrishna149 commented 8 years ago

Hi,

I am working with jSignature in my application using asp.net mvc angularjs. I want to do vallidate this signature as required. I tried using getdata method when canvas is empty and i get the signature length is 2430. how can i validate the signature. please help me asap.

Code: $scope.saveSignature = function () { var data = $("#signature").jSignature("getData"); alert(data.length); $scope.SignData = sig.jSignature('getData'); }

I want to validate the signature in saveSignature function. Please help me

brinley commented 8 years ago

Try using ismodified to check if the canvas has any content

harikrishna149 commented 8 years ago

Hi Brinley,

isModified method is working fine when cavas has no content. but how can we validate the signature using isModidied and getdata length?.

I am using both the methods and i am getting some length of canvas conent. how to validate that canvas content length?

Thanks, Harikrishna

brinley commented 8 years ago

getData on a canvas will always return data even for a blank canvas. Perhaps you can save the data for your blank canvas and use that to compare if there is any content.

peerles commented 6 years ago

Why not use the method like this: '$sigdiv.jSignature('getData', 'native').length'? if the length is 0, then the canvas has no content, else the canvas has any content and the lenth is eauals to the number of strokes