Have an idea?

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

Auto submit drag and drop question

I´m using sawtooth 9.3.0

I have a question drag and drop using the library categorization and I´d like to auto submit the question after the user range all the items.

I try to use the function SSI_SubmitMe and document.mainform.submit and both didn´t work. I added a class initalSortable to know where the items start and my code is like this:

    //auto submit when rate all brands
    if( $('#initialSortable').is(':empty') ) {

I used similar code in JavaScript verification to not allow the user go to the next question when still have items to range and it works.

What can I do to solve my issue?
asked Mar 22, 2017 by Arian
One thing to be careful of here is when a respondent has dragged the number of ranked items across, sometimes they may want to reorder them in the ranked bucket so auto submit may not be ideal. Just a thought.

1 Answer

+1 vote
Best answer
You've got the code right.  Now we just need to put it somewhere that will run it whenever an item is moved from one category to another.  jQuery UI's "sortable" has a "stop" event for just this purpose.  In the Categorization's footer, you can find some code like this towards the end:

stop: function(event, ui) {

Immediately before the closing curly bracket of the above code, add your JS:

            // Auto-submit
            if ($('#[% QuestionName() %]_defaultSortableContainer .sortable').is(':empty')) {
answered Mar 22, 2017 by Zachary Platinum Sawtooth Software, Inc. (98,000 points)