Have an idea?

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

Select qestion with grid-numeric question

Dear All,

Q1 (Select Question) Which one factor would contribute the most to the satisfaction? [SA]
1. Statement A
2. Statement B
3. Statement C
4. Statement D
5. Statement E

Q2 (Select Question) Which one factor would contribute the least to the satisfaction? [SA]
1. Statement A
2. Statement B
3. Statement C
4. Statement D
5. Statement E

Q3 (Grid-question at numeric) Programming Instruction:
- AUTOCODE 100 FOR FACTOR CODED AT Q1.
- AUTOCODE 1 FOR FACTOR CODED AT Q2.
- For each of the remaining factors, please input a value between 2 and 99.
- No 2 factors can be given the same score.

***Note: Q1, Q2 and Q3 are all the same parente list.

Hope you understand!

Thanks
asked Oct 12 by Saroeun Bronze (1,850 points)
What exactly does "autocode" mean in this situation?

The Q1 and Q2 responses don't actually show up in Q3 and their responses are automatically set to 1 and 100?

The Q1 and Q2 responses do show up in Q3 just pre-filled with these values?  If so, are respondents allowed to change these pre-filled values?
Thanks Zachary,

Q1 and Q2 responses must show up in Q3 just pre-filled,
=> which code answer in Q1 must show up 100 in Q3.
=> which code answer in Q2 must show up 1 in Q3.
=> For each of the remaining factors, please input a value between 2 and 99.
=> No 2 factors can be given the same score.

1 Answer

0 votes
Add this script to the question proper:

<script>
$(document).ready(function(){
    $('#[% QuestionName() %]_r[% Q1 %]_c1').val(100);
    $('#[% QuestionName() %]_r[% Q2 %]_c1').val(1);
})
</script>


"Q1" and "Q2" being the names of the first two questions, of course.

Then give it this custom JavaScript verification:

var rows = $('input[name="hid_row_list_[% QuestionName() %]"]').val().split(',');
var columns = $('input[name="hid_col_list_[% QuestionName() %]"]').val().split(',');
var responses = {};
rows.forEach(function(row){
    columns.forEach(function(column){
        var response = SSI_GetValue('[% QuestionName() %]_r' + row + '_c' + column);
        if (responses[response]) {
            strErrorMessage = 'Responses cannot be repeated.';
        }
        responses[response] = true;
    });
});
answered Oct 14 by Zachary Platinum Sawtooth Software, Inc. (129,150 points)
...