Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Extending numeric question range

I would like to extend the numeric range to 16 digits. Sawtooth displayed an error saying 9 digits is the maximum.

Can I change this somehow?
asked Jul 11, 2012 by Paul Moon Platinum (62,800 points)
retagged Sep 13, 2012 by Walter Williams

2 Answers

+2 votes
I created open end question for such type of problem and used custom javascript to check if it consists numeric value only, In my case, I created grid question S9b and used below script to check this.

var checkOK = "0123456789";
var k=0;
var check=new Array();
var allValid = true;
var str = document.mainform.S9b_r1_c1.value;
  var str1 = parseInt(document.mainform.S9b_r1_c1.value);
for (i = 0;  i < str.length;  i++)
    ch = str.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
    if (ch == checkOK.charAt(j))
    if (j == checkOK.length)
        allValid = false;

if ((!allValid) || (str1==0))
strErrorMessage="A response is required.";

If you are looking to update any quota based on this value then use below function:


Hope it helps you.
answered Jul 11, 2012 by Rajesh Rana Gold (23,430 points)
Extending numeric question range
you could use
function isNumber(n) {
  return !isNaN(parseFloat(n)) && isFinite(n);
that I found on http://stackoverflow.com/questions/18082/validate-numbers-in-javascript-isnumeric
+2 votes
Paul, I have something set up that I use for collecting a zipcode and was having issues with the numeric field and some zipcodes starting with 0 so I now set it up as a text box and add the following javascript to the javascript verification tab.  It's simple and you should be able to use it for your purposes.  If you set up a textbox in Free Format and in the parameters you can set the minimum and maximum number of characters adn then add this, let's call it Q1_r1:

var q1var=SSI_GetValue("Q1_r1");
var strErrorMessage = "The response must be numeric. Please enter a numeric answer for this question";
answered Jul 11, 2012 by Jay Rutherford Gold (25,735 points)