Page 1 of 1
Change ink sketch pad color
Posted: 26 Feb 2018
by ragesoft
Hi,
i've found this thread here descriping the possibility to change the color of the ink sketch dynamical:
viewtopic.php?f=1&t=1126&p=4721&hilit=color#p4721
i've tried it out, but i dont get the signeturepad object back.
I'm able to set the new color by creating a complete new SignaturePad:
Code: Select all
var padControl = $('.sketchPad');
var signPad = new Plumsail.FD.SignaturePad(padControl[0]);
signPad.penColor = "red";
but this resets the whole skretch...
Why is the solution from the link not working?
Re: Change ink sketch pad color
Posted: 26 Feb 2018
by Nikita Kurguzov
Dear ragesoft,
Have you added an appropriate class to the Ink Sketch in the editor? This is used for reference in the example.
- CSS class.png (2.48 KiB) Viewed 1903 times
Re: Change ink sketch pad color
Posted: 27 Feb 2018
by ragesoft
For sure.
See screenshot.
Re: Change ink sketch pad color
Posted: 27 Feb 2018
by Nikita Kurguzov
Dear ragesoft,
There could be an issue if you are trying to change color before the Ink Sketch control loads, to prevent it use the following code:
Code: Select all
var interval = setInterval(function(){
if($('.sketchPad')){
var signaturePad = $('.sketchPad').data('signaturePad');
signaturePad.penColor = 'red';
clearInterval(interval);
}
}, 1000);
Tell me if this is the case or not. And if it is, does the code help? If it doesn't, please show me your browser's console from the form, so I can see the error, please. But I hope this will fix it.
Re: Change ink sketch pad color
Posted: 28 Feb 2018
by ragesoft
i dont belive its a time problem, because the signaturePad data isn't available even after opening dev-tools in browser and search for it with console.
In console there are no SPForms related errors (see screenshot).
Pls see also the html of the canvas inside the form.
If i debug the plumsail.fd.core.js and plumsail.fd.signature.js i see the processing of the canvas and the initiation of the data objekt with line:
but after this, the data is not available at the html object
Re: Change ink sketch pad color
Posted: 28 Feb 2018
by Nikita Kurguzov
Dear ragesoft,
Can you please tell me which version of Forms Designer you are using? It can be found in the bottom right corner:
- VersionNumber.png (2.97 KiB) Viewed 1893 times
And also, version of SharePoint in question - is it SharePoint Online or SharePoint 2013/16?
Re: Change ink sketch pad color
Posted: 28 Feb 2018
by ragesoft
This one like u posted
3.1.4 as demo licence.
Re: Change ink sketch pad color
Posted: 28 Feb 2018
by Nikita Kurguzov
Dear ragesoft,
Can you show me what code you are trying to use inside JavaScript framework as it is? And also, try to use the same code from browser's console. I want to see the error itself that you get.
Re: Change ink sketch pad color
Posted: 08 Mar 2018
by ragesoft
Here is my code inside the "JavaScript" option from the Editor:
Code: Select all
var signPad = $('.sketchPad').data('signaturePad');
signPad.penColor = $(this).val();
console.log("New Color: " + $(this).val());
($(this) is related to a textfield "onchange" event
)
And here is the code from console:
Code: Select all
var signaturePad = $('.sketchPad').data('signaturePad')
undefined
signaturePad
undefined