I've been trying to develop develop a method for eliciting preferences for an academic study using SurveyGizmo's custom question functionality. I've managed to script the html layout and basic functioning, but I'm failing at the task of storing user input data within the SurveyGizmo framework.
The question involves making a choice between two objectives (via radio button) and then weighting the objectives against each other (via numerical text entry). I'm able to store the checked radio button, which is the best I've achieved out of everything I've tried so far.
I've toiled on this for ages and scoured the internet looking for useful instruction with no success.
Here is an excerpt of the html code that represents the question format:
<table>
<tr>
<th align="left">Objective</th>
<th align="left">Worst</th>
<th align="left">Best</th>
<th align="center">Select</th>
<th>Weight</th>
</tr>
<tr>
<td>A</td>
<td>300<name="row-1" data-col="1"></td>
<td>500<name="row-1" data-col="2"></td>
<td align="center"><input id="SelectObjA-%elementid%" type="radio" value="SelectA" name="select-Q1" data-col="3" class="sg-input sg-input-radio"></td>
<td align="center"><input id="WeightObjA-%elementid%" class="sg-input sg-input-text" type="text" name="WeightObjA" maxlength="3" size="3" data-col="4"></td>
</tr>
<tr>
<td>B</td>
<td>9 <name="row-2" data-col="1"></td>
<td>2 <name="row-2" data-col="2"></td>
<td align="center"><input id="SelectObjB-%elementid%" type="radio" value="SelectB" name="select-Q1" data-col="3" class="sg-input sg-input-radio"></td>
<td align="center"><input id="WeightObjB-%elementid%" class="sg-input sg-input-text" type="text" name="WeightObjB" maxlength="3" size="3" data-col="4"></td>
</tr>
</table>
So far the only JavaScript for storing input data that works is:
{
onload: function() {
//Code to be executed
},
onsubmit: function() {
//Code to be executed
var select = $SG("input[name=select-Q1]:checked").val();
this.setStorageValue(select);
}
}
I'd really appreciate any help in resolving the problem of how to store the user input data for all of the form fields: radio and both text inputs.