1

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.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
tui
  • 37
  • 8
  • [This earlier post](http://stackoverflow.com/questions/2010892/storing-objects-in-html5-localstorage) is about storing objects into json-strings and save them into localstorage in HTML5. Just an alternative approach instead of SurveyGizmo – ClydeFrog Jan 17 '13 at 07:48
  • You seem to be missing a `` in your table head. – Cerbrus Jan 17 '13 at 07:51
  • [This example](http://developer.surveygizmo.com/custom-question-examples/) might be helpful, but I can't make sense of `setMultiStorageValue` and `getOptionSku` (I have absolutely no programming experience before this). – tui Jan 21 '13 at 03:53

0 Answers0