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
|
|
@ -18,6 +18,9 @@ if (typeof Survey === "undefined") {
|
|||
'Currency': 1,
|
||||
'TextArea': 1
|
||||
};
|
||||
var NUMBER_TYPES = {
|
||||
'Number':1
|
||||
};
|
||||
var SLIDER_TYPES = {
|
||||
'Slider': 1,
|
||||
'Dual Slider - Range': 1,
|
||||
|
|
@ -65,6 +68,17 @@ if (typeof Survey === "undefined") {
|
|||
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') {
|
||||
answered = 1;//set to true, then let a single failure set it back to false.
|
||||
for (var z1 in toValidate[i].answers) {
|
||||
|
|
@ -607,6 +621,12 @@ if (typeof Survey === "undefined") {
|
|||
}
|
||||
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
|
||||
var butts = [];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue