Preliminary check in for new Survey text number type and validation.
This commit is contained in:
parent
fa2768ea50
commit
caffe2751a
3 changed files with 22 additions and 1 deletions
|
|
@ -1313,7 +1313,7 @@ sub prepareShowSurveyTemplate {
|
||||||
# 'Security', 1
|
# 'Security', 1
|
||||||
# );
|
# );
|
||||||
my %textArea = ( 'TextArea', 1 );
|
my %textArea = ( 'TextArea', 1 );
|
||||||
my %text = ( 'Text', 1, 'Email', 1, 'Phone Number', 1, 'Text Date', 1, 'Currency', 1 );
|
my %text = ( 'Text', 1, 'Email', 1, 'Phone Number', 1, 'Text Date', 1, 'Currency', 1, 'Number', 1 );
|
||||||
my %slider = ( 'Slider', 1, 'Dual Slider - Range', 1, 'Multi Slider - Allocate', 1 );
|
my %slider = ( 'Slider', 1, 'Dual Slider - Range', 1, 'Multi Slider - Allocate', 1 );
|
||||||
my %dateType = ( 'Date', 1, 'Date Range', 1 );
|
my %dateType = ( 'Date', 1, 'Date Range', 1 );
|
||||||
my %dateShort = ( 'Year Month', 1 );
|
my %dateShort = ( 'Year Month', 1 );
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,7 @@ sub loadTypes {
|
||||||
'Slider',
|
'Slider',
|
||||||
'Currency',
|
'Currency',
|
||||||
'Email',
|
'Email',
|
||||||
|
'Number',
|
||||||
'Phone Number',
|
'Phone Number',
|
||||||
'Text',
|
'Text',
|
||||||
'Text Date',
|
'Text Date',
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,9 @@ if (typeof Survey === "undefined") {
|
||||||
'Currency': 1,
|
'Currency': 1,
|
||||||
'TextArea': 1
|
'TextArea': 1
|
||||||
};
|
};
|
||||||
|
var NUMBER_TYPES = {
|
||||||
|
'Number':1
|
||||||
|
};
|
||||||
var SLIDER_TYPES = {
|
var SLIDER_TYPES = {
|
||||||
'Slider': 1,
|
'Slider': 1,
|
||||||
'Dual Slider - Range': 1,
|
'Dual Slider - Range': 1,
|
||||||
|
|
@ -65,6 +68,17 @@ if (typeof Survey === "undefined") {
|
||||||
alert("Please allocate the remaining " + amountLeft + ".");
|
alert("Please allocate the remaining " + amountLeft + ".");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (toValidate[i].type === 'Number') {
|
||||||
|
answered = 1;
|
||||||
|
for (var z1 in toValidate[i].answers) {
|
||||||
|
var m = document.getElementById(z1).value;
|
||||||
|
var ansValues = toValidate[i].answers[z1];
|
||||||
|
if(m > ansValues.max || m < ansValues.min || m % ansValues.step != 0){
|
||||||
|
answered = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (toValidate[i].type === 'Year Month') {
|
else if (toValidate[i].type === 'Year Month') {
|
||||||
answered = 1;//set to true, then let a single failure set it back to false.
|
answered = 1;//set to true, then let a single failure set it back to false.
|
||||||
for (var z1 in toValidate[i].answers) {
|
for (var z1 in toValidate[i].answers) {
|
||||||
|
|
@ -607,6 +621,12 @@ if (typeof Survey === "undefined") {
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (NUMBER_TYPES[q.questionType]) {
|
||||||
|
if (toValidate[q.id]) {
|
||||||
|
toValidate[q.id].answers[q.answers[x].id] = {'min':q.answers[x].min,'max':q.answers[x].max,'step':q.answers[x].step};
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Must be a multi-choice bundle
|
// Must be a multi-choice bundle
|
||||||
var butts = [];
|
var butts = [];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue