Have an idea?

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

Free Format Question - Discrepancy between variable name and question HTML

I'm taking over the management of a survey the previous team created and noticed that data weren't saved to a variable.
I noticed a discrepancy between the variable name and question HTML. Can someone confirm if this is causing the problem?

Question name: D18
Variable name: D18_NewVar
HTML:
 <input name="D12_NewVar" id="D12_NewVar" class="numeric_input" type="text" size="5"> 


When I download the data, there's a column in the CSV file with the header "D18_NewVar" but no values (all blank).
Where were the data saved to?
Is there any way to recover the data?
asked Apr 27 by wfung (275 points)

1 Answer

+1 vote
 
Best answer
If the html didn't use the correct variable name, then it would be blank and the data was not saved anywhere.  While it may look fine when testing, there is nowhere for the data to be saved if the html doesn't use the correct variable name.  I made this mistake once and now always check to make sure test data is saving correctly before going live.
answered Apr 27 by Jay Rutherford Platinum (52,045 points)
selected Apr 27 by wfung
Thank you Jay. To fix this, I would just need to change the variable name in the HTML from "D12_NewVar" to "D18_NewVar"?
 <input name="D18_NewVar" id="D18_NewVar" class="numeric_input" type="text" size="5"> 
Yes.  I would still do a test after making that change to confirm you are then collecting the expected data.
There's a Sawtooth Script function that automatically returns the name of the current question.  I recommend using this function for situations like this so that renames just work.

<input name="[% QuestionName() %]_NewVar" id="[% QuestionName() %]_NewVar" class="numeric_input" type="text" size="5">
...