Have an idea?

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

No data saved for free format grid questions

I’ve got a survey that will not keep the data from a free format grid with 3 questions.  The third question appears if they answer yes to the second question.  When I answer all three questions in the test mode, the survey returns an error that the second question was not answered.  And when I generate test data, all variables are empty starting with the first question in this grid.  I started with a previous survey where this worked, and changed the variable names.  I’m hoping it is something simple that I’m missing, as I’m not too familiar with the free format questions yet.  The programming code is below.

Any help you can provide will be greatly appreciated.  Thank you.


Script from the Advanced Settings HTML <head> Tag box:  
<script type="text/javascript">
       function hide(el) {
              el_obj = document.getElementById(el)
              el_obj.style.display = 'none';
       }
       
       function show(el) {
              el_obj = document.getElementById(el)
              el_obj.style.display = 'block';
       }
function GetRadioValueChecked(RadioObj)
{
   var i = 0;
   var intValue = 0;

   if(RadioObj.length)
   {
        for(i = 0; i < RadioObj.length; i++)
        {
             if(RadioObj[i].checked)
             {
                   intValue = RadioObj[i].value;
             }
        }
   }
   else
   {
         intValue = RadioObj.value;
   }

   return intValue;
}
</script>

Script from the Variables/Question HTML box:  
<TABLE WIDTH="1000" BORDER="1">
  <TR BGCOLOR=#E0E0E0>
    <TD WIDTH="250">
      <center><u><b></b></u></center>
    </TD>
    <TD WIDTH="250">
      <center><B><u>Methicillin Resistant Staph aureus (MRSA)</u></B></center>
    </TD>
    <TD WIDTH="250">
      <center><B><u>Methicillin Susceptible Staph aureus (MSSA)</u></B></center>
    </TD>
    <TD WIDTH="250">
      <center><B><u>Clostridium difficile</u></B></center>
    </TD>
  </TR>
  
<TR BGCOLOR=#FFFFFF>
  <TD>
    <div id = "div_qdictext">
    <b>What is the primary method used by your hospital's lab for routine testing?</b>
    </div>
  </TD>
  <TD ALIGN="left">
    <div id = "div_qdic">
     <input name="Grid_Q7dic" type="radio" value="1"> Traditional Culture<br>
     <input name="Grid_Q7dic" type="radio" value="2"> Chromogenic Media<br>
     <input name="Grid_Q7dic" type="radio" value="3"> Commercial Molecular Test<br>
     <input name="Grid_Q7dic" type="radio" value="4"> Lab-developed or Homebrew<br> 
     <input name="Grid_Q7dic" type="radio" value="5"> Don't know
    </div>
  </TD>
  <TD ALIGN="left">
    <div id = "div_q8dic">
     <input name="Grid_Q8dic" type="radio" value="1"> Traditional Culture<br>
     <input name="Grid_Q8dic" type="radio" value="2"> Chromogenic Media<br>
     <input name="Grid_Q8dic" type="radio" value="3"> Commercial Molecular Test<br>
     <input name="Grid_Q8dic" type="radio" value="4"> Lab-developed or Homebrew<br> 
     <input name="Grid_Q8dic" type="radio" value="5"> Don't know
    </div>
  </TD>
  <TD ALIGN="left">
    <div id = "div_q9dic">
     <input name="Grid_Q9dic" type="radio" value="1"> Traditional Culture<br>
     <input name="Grid_Q9dic" type="radio" value="2"> Chromogenic Media<br>
     <input name="Grid_Q9dic" type="radio" value="3"> Commercial Molecular Test<br>
     <input name="Grid_Q9dic" type="radio" value="4"> Lab-developed or Homebrew<br> 
     <input name="Grid_Q9dic" type="radio" value="5"> Don't know
    </div>
  </TD>
</TR>

 <TR BGCOLOR=#FFFFFF>
  <TD>
    <div id = "div_qeictext">
    <b>Does your hospital's lab use a different method of testing (or a different commercial test) for urgent or after hours/weekend testing?</b>
    </div>
  </TD>
  <TD ALIGN="left">
    <div id = "div_q7eic">
     <input name="Grid_Q7eic" type="radio" value="1" onClick = "show('div_qfictext'); show('div_q7fic')">Yes<br>
     <input name="Grid_Q7eic" type="radio" value="2" onClick = "hide('div_q7fic')"> No/ Don't know<br>
    </div>
  </TD>
  <TD ALIGN="left">
    <div id = "div_q8eic">
     <input name="Grid_Q8eic" type="radio" value="1" onclick ="show ('div_qfictext'); show ('div_q8fic')"> Yes<br>
     <input name="Grid_Q8eic" type="radio" value="2" onclick ="hide ('div_q8fic')"> No/ Don't know<br>
    </div>
  </TD>
  <TD ALIGN="left">
    <div id = "div_q9eic">
     <input name="Grid_Q9eic" type="radio" value="1" onclick ="show ('div_qfictext'); show ('div_q9fic')"> Yes<br>
     <input name="Grid_Q9eic" type="radio" value="2" onclick ="hide ('div_q9fic')"> No/Don't know<br>
    </div>
  </TD>
</TR>

 <TR BGCOLOR=#FFFFFF>
  <TD>
    <div id = "div_qfictext" style = "display:none">
    <b>What is the primary method you currently use for urgent and/or after hours and weekend testing?</b>
    </div>
  </TD>
  <TD ALIGN="left">
    <div id = "div_q7fic" style = "display:none">
     <input name="Grid_Q7fic" type="radio" value="1"> Traditional Culture<br>
     <input name="Grid_Q7fic" type="radio" value="2"> Chromogenic Media<br>
      <input name="Grid_Q7fic" type="radio" value="2"> Commercial Molecular Test<br>
      <input name="Grid_Q7fic" type="radio" value="2"> Lab-developed Test<br>
    </div>
  </TD>
  <TD ALIGN="left">
    <div id = "div_q8fic" style = "display:none">
     <input name="Grid_Q8fic" type="radio" value="1"> Traditional Culture<br>
     <input name="Grid_Q8fic" type="radio" value="2"> Chromogenic Media<br>
      <input name="Grid_Q8fic" type="radio" value="2"> Commercial Molecular Test<br>
      <input name="Grid_Q8fic" type="radio" value="2"> Lab-developed Test<br>
    </div>
  </TD>
  <TD ALIGN="left">
    <div id = "div_q9fic" style = "display:none">
     <input name="Grid_Q9fic" type="radio" value="1"> Traditional Culture<br>
     <input name="Grid_Q9fic" type="radio" value="2"> Chromogenic Media<br>
      <input name="Grid_Q9fic" type="radio" value="2"> Commercial Molecular Test<br>
      <input name="Grid_Q9fic" type="radio" value="2"> Lab-developed Test<br>
    </div>
  </TD>
</TR>

 </TABLE>
asked Mar 23, 2015 by Sarah (120 points)

1 Answer

0 votes
Do you have a semicolon after the lines with this code:
el_obj = document.getElementById(el)

If not, add the ;
answered Mar 24, 2015 by Gary Baker Silver Sawtooth Software, Inc. (6,880 points)
Thanks Gary.  It did not, but that didn't fix my problem.  I suspect that it has something to do with the original code being from a survey programmed with Ver. 6, and I'm using it in the newest version 8. I think the old code isn't working with JQuery without modifications.

I've reprogrammed this series as separate questions for now and will try to figure this out for next time.
...