Question T2500
Visible to All Users

How to instantiate signature pad in requirejs

created 6 years ago

Having some issues working out how to use signature with require configuration. And which JS files need to be included?

config file
"Survey": "assets/js/common/surveyjs/survey.jquery.min",
"tagbox": "assets/js/common/widgets/surveyjs-widgets/select2-tagbox.min",
"signaturepad": "assets/js/common/widgets/surveyjs-widgets/signature_pad.min",

usage
define(
[
"jquery",
"Survey",
"signaturepad",
"tagbox"
],
function(
$,
Survey
) {
"use strict";

Survey.StylesManager.applyTheme("bootstrap");
initTagbox(Survey, $);

}
)

Answers approved by surveyjs Support

created 6 years ago

Hello,

I've forked your plunker and make it use the signaturepad custom widget -
https://plnkr.co/edit/n05x9xHBfUwlSO8MyWgJ?p=preview

Thanks, Serge
SurveyJS Team

    Comments (1)

      Thanks Serge, that got it displayed.

      created 6 years ago

      Hello,

      Probably you need to load surveyjs-widgets.js file.

      Thanks, Serge
      SurveyJS Team

        Comments (3)

          Ok, I was missing that, thought I had it in my shims.

          Ignore that, still not seeing it. I get that error if I add the below but no errors otherwise and no signature pad:

          signaturepad(Survey, $);

          Uncaught TypeError: Cannot set property 'velocityFilterWeight' of undefined
          at n (signature_pad.min.js:1)
          at ApplicationController.js?2019.3.3.0:35
          at Object.execCb (require.min.js:1)
          at x.check (require.min.js:1)
          at x.<anonymous> (require.min.js:1)
          at require.min.js:1
          at require.min.js:1
          at each (require.min.js:1)
          at x.emit (require.min.js:1)
          at x.check (require.min.js:1)

            Hello,

            I don't see any our code in this stack trace. In order to detect the issue we need to reproduce it locally.
            Please provide us with a minimal working sample illustrating the issue.

            Thanks, Serge
            SurveyJS Team

              https://plnkr.co/edit/BOQEFcwe1IJFi4dGSjiU

              This is pretty close to our environment. I can get the checkbox to display but not the signature box.