Open seport opened 8 years ago
@seport you must have something else messed up. doing exactly what you provided produces an signature for me. Just make sure you've initialized the component first:
$sigdiv= $("#signature");
$sigdiv.jSignature();
$sigdiv.jSignature("setData", "data:image/jsignature;base30,cVZ1000Y59ce1Gomn1Sla4331222_2Q9aad331000000062344544") ;
Strange... what do you mean by initializing the component first? I thought that was just var $sigdiv = $("#signature")
? Or in my case
var $sigdiv;
$sigdiv = $("#signature")
I'll play with it again tonight...
@seport the following line of jquery only gets a reference to the DIV that will be used to host your jSignature component:
$sigdiv = $("#signature") ;
The Initialize comment I made before just means to call this line of code first:
$sigdiv.jSignature();
And then, after that, you can call the setData method with this line:
$sigdiv.jSignature("setData", "data:image/jsignature;base30,cVZ1000Y59ce1Gomn1Sla4331222_2Q9aad331000000062344544") ;
Oh I see. I think I did call that first, but I'll try it again and report back. Thanks for your help!
I have a rails web app which stores signatures in a database. Each entry in the database is editable and when you pull up the edit page for a particular entry with an existing signature, I'd like to initialize the jSignature widget with the existing signature on file.
According to some sleuthing on stack overflow and looking at your documentation it looks like
$sigdiv= $("#signature") $sigdiv.jSignature("setData","data:image/jsignature;base30,cVZ1000Y59ce1Gomn1Sla4331222_2Q9aad331000000062344544")
should initialize the widget with some signature displayed automatically. However, this is breaking the widget (resulting in an empty #signature div). Based on your documentation it's not totally clear to me whether I'm even using setData for its intended purpose.