Have an idea?

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

Autofill Grid Ranking Question

I have a grid question, with 5 rows and one column.  Each row contains a statement and in the first column, the respondent will rank each statement using a combo box.  They can choose from "Most appealing," "Second," "Third," "Fourth," and "Least Appealing."  

I was asked to make the question so that when a respondent ranks four out of the five statements, the fifth statement will be automatically filled in for them.  How can I do this?

Thanks in advance!
asked Jan 29, 2019 by anonymous

1 Answer

+1 vote
Best answer
Try adding this script to your grid question:

    $('#[% QuestionName() %]_div select').change(function(){
        if ($(this).val()) {
            var resps = [1, 2, 3, 4, 5];
            var emptySelect;
            $('#[% QuestionName() %]_div select').each(function(){
                var value = $(this).val();
                if (value) {
                    for (var i = 0; i < resps.length; i++) {
                        if (resps[i] == value) {
                            resps.splice(i, 1);
                else {
                    emptySelect = $(this);
            if (resps.length == 1) {
answered Jan 30, 2019 by Zachary Platinum Sawtooth Software, Inc. (206,100 points)
Thanks Zachary!  It works perfectly.