comparison js/core.js @ 2730:a13adc8f8d3d

#201 Fixed
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Wed, 19 Apr 2017 09:30:06 +0100
parents 9c01d5dd22a2
children f2bb15d5f5c9
comparison
equal deleted inserted replaced
2728:07fcccd5e1a6 2730:a13adc8f8d3d
871 this.popupResponse.style.left = "0%"; 871 this.popupResponse.style.left = "0%";
872 } 872 }
873 873
874 function processNumber(node) { 874 function processNumber(node) {
875 var input = this.popupContent.getElementsByTagName('input')[0]; 875 var input = this.popupContent.getElementsByTagName('input')[0];
876 if (node.mandatory === true && input.value.length === 0) { 876 if (node.specification.mandatory === true && input.value.length === 0) {
877 interfaceContext.lightbox.post("Error", 'This question is mandatory. Please enter a number'); 877 interfaceContext.lightbox.post("Error", 'This question is mandatory. Please enter a number');
878 return false; 878 return false;
879 } 879 }
880 var enteredNumber = Number(input.value); 880 var enteredNumber = Number(input.value);
881 if (isNaN(enteredNumber)) { 881 if (isNaN(enteredNumber)) {
882 interfaceContext.lightbox.post("Error", 'Please enter a valid number'); 882 interfaceContext.lightbox.post("Error", 'Please enter a valid number');
883 return false; 883 return false;
884 } 884 }
885 if (enteredNumber < node.min && node.min !== null) { 885 if (enteredNumber < node.specification.min && node.specification.min !== null) {
886 interfaceContext.lightbox.post("Error", 'Number is below the minimum value of ' + node.min); 886 interfaceContext.lightbox.post("Error", 'Number is below the minimum value of ' + node.specification.min);
887 return false; 887 return false;
888 } 888 }
889 if (enteredNumber > node.max && node.max !== null) { 889 if (enteredNumber > node.specification.max && node.specification.max !== null) {
890 interfaceContext.lightbox.post("Error", 'Number is above the maximum value of ' + node.max); 890 interfaceContext.lightbox.post("Error", 'Number is above the maximum value of ' + node.specification.max);
891 return false; 891 return false;
892 } 892 }
893 node.response = input.value; 893 node.response = input.value;
894 processConditional.call(this, node, node.response); 894 processConditional.call(this, node, node.response);
895 return true; 895 return true;