Skip to content

Commit de0597f

Browse files
Andrew Telnov (DevExpress)Andrew Telnov (DevExpress)
authored andcommitted
do not activate widgets if their scripts are not loaded
1 parent 4c4fb22 commit de0597f

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

src/icheck.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ function init(Survey) {
22
var widget = {
33
className: "iradio_square-blue",
44
name: "icheck",
5-
isFit : function(question) { var t = question.getType(); return t === 'radiogroup' || t === 'checkbox' || t === 'matrix'; },
5+
isFit : function(question) {
6+
if(typeof iCheck == undefined && typeof _iCheck == undefined) return false;
7+
var t = question.getType(); return t === 'radiogroup' || t === 'checkbox' || t === 'matrix';
8+
},
69
isDefaultRender: true,
710
afterRender: function(question, el) {
811
var rootWidget = this;

src/inputmask.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ function init(Survey) {
88
numericPrefix: '$',
99
numericPlaceholder: '0',
1010
isFit : function(question) {
11+
if(typeof Inputmask == undefined) return false;
1112
if(question.getType() == "multipletext") return true;
1213
return question.getType() == "text" && (question.inputMask != "none" || question.inputFormat);
1314
},

src/select2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function init(Survey) {
55
htmlTemplate: "<select style='width: 100%;'></select>",
66
isFit : function(question) {
77
if(widget.activatedBy == "property") return question["renderAs"] === 'select2' && question.getType() === 'dropdown';
8-
if(widget.activatedBy == "type") return question.getType() === 'dropdown';
8+
if(widget.activatedBy == "type") return typeof Select2 !== undefined && question.getType() === 'dropdown';
99
if(widget.activatedBy == "customtype") return question.getType() === 'select2';
1010
return false;
1111
},

0 commit comments

Comments
 (0)