Comment 3 for bug 1158358

Revision history for this message
Olivier Tilloy (osomon) wrote :

And here is the JS code that’s invoked when an option is selected (from http://secure.surveymonkey.com/js/RankingQuestion.js?rv=201303191245):

    RankingQuestion.RankChange = function(e) {
        if (e == null)
            var e = window.event;
        var target = e.target ? e.target : e.srcElement;

        if (target.selectedIndex == 0 || SM_APP.DOM.hasClass(target.options[target.selectedIndex], 'disabledOption')) {
            target.selectedIndex = parseInt(target.getAttribute('oldIdx'));
        } else if (target.options[target.selectedIndex].getAttribute("isNa") == 'true') {
            setTimeout(function() {
                target.parentNode.childNodes[1].checked = true;
                RankingQuestion.ToggleNA(target.parentNode, true);
                RankingQuestion.FadeIn(target.parentNode);
            }, 100);
        } else {
            var opt = target.parentNode;
            var container = opt.parentNode;
            var pos = target.selectedIndex - 1;
            RankingQuestion.MovePlaceHolder(pos, opt);

            setTimeout(function() {
                container.insertBefore(opt, RankingQuestion.PlaceHolder);
                container.removeChild(RankingQuestion.PlaceHolder);
                RankingQuestion.FadeIn(opt);
                RankingQuestion.CalculateRanks(container);
            }, 100);
        }
    };