Change ink sketch pad color

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
ragesoft
Posts: 50
Joined: Fri Feb 23, 2018

26 Feb 2018

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?

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

26 Feb 2018

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
CSS class.png (2.48 KiB) Viewed 1900 times
Cheers

ragesoft
Posts: 50
Joined: Fri Feb 23, 2018

27 Feb 2018

For sure.
See screenshot.
Attachments
spforms_inksketch_cssclass.png
spforms_inksketch_cssclass.png (27.61 KiB) Viewed 1899 times

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

27 Feb 2018

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.
Cheers

ragesoft
Posts: 50
Joined: Fri Feb 23, 2018

28 Feb 2018

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:

Code: Select all

i.data("signaturePad", t);
but after this, the data is not available at the html object :(
Attachments
spforms_inksketch_debug.png
spforms_inksketch_debug.png (45.65 KiB) Viewed 1892 times
spforms_inksketch_html.png
spforms_inksketch_html.png (24.57 KiB) Viewed 1892 times
spforms_inksketch_consollog.png
spforms_inksketch_consollog.png (21.58 KiB) Viewed 1892 times

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

28 Feb 2018

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
VersionNumber.png (2.97 KiB) Viewed 1890 times
And also, version of SharePoint in question - is it SharePoint Online or SharePoint 2013/16?
Cheers

ragesoft
Posts: 50
Joined: Fri Feb 23, 2018

28 Feb 2018

This one like u posted :)

3.1.4 as demo licence.

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

28 Feb 2018

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.
Cheers

ragesoft
Posts: 50
Joined: Fri Feb 23, 2018

08 Mar 2018

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

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 9 guests