Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

While giving survey, Clicking on Submit, doesnt refresh page immediately

  • patecj
  • patecj's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 7 months ago #172319 by patecj
I have created one survey which is for closed group and has only one question.

While giving survey by user, user gives answer and clicks submit but page takes a while to refresh page. This delay make user confused and they click twice/thrice on submit thinking their response has not submitted and end up seeing page where they need to enter token.

How can I disable submit on submit or how can I show progress bar to indicate user that page is loading?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 7 months ago - 5 years 7 months ago #172322 by tpartner
Assuming you are using a current LimeSurvey version, you can add this script to the source of a question on the last page. It will display a modal spinner when the "Submit" button is clicked.

Code:
<script type="text/javascript" charset="utf-8">
 
  $(document).on('ready pjax:scriptcomplete',function(){
 
    $('body').append('<div class="modal fade spinner-modal" data-backdrop="static" data-keyboard="false" tabindex="-1">\
              <div class="modal-dialog modal-sm">\
                <div class="modal-content" style="width: 100px; padding: 10px 0; text-align:center;">\
                  <span class="fa fa-spinner fa-spin fa-3x" style="font-size: 6em;"></span>\
                </div>\
              </div>\
            </div>');
 
    $('#ls-button-submit').on('click', function(e) {
      $('.spinner-modal').modal('show');
    });
  });
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 5 years 7 months ago by tpartner.
The topic has been locked.
  • patecj
  • patecj's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 7 months ago #172340 by patecj
This looks good and works.

Only issue is, I have to do this manually in last question for all surveys.
Also, this spinner image doesn't go off even after submitting Survey. Hence, script display Thank you page but with spinner.

Is there any permanent solution which I can apply on code itself?
The topic has been locked.
More
5 years 7 months ago #172342 by jelo
What LimeSurvey version is used?

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • patecj
  • patecj's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 7 months ago #172343 by patecj
LimeSurvey
Version 3.13.2+180709
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 7 months ago - 5 years 7 months ago #172405 by tpartner

Only issue is, I have to do this manually in last question for all surveys.

If you want the spinner on the final question page of every survey using a specific template, add this to the template custom.js file.

Code:
  $(document).on('ready pjax:scriptcomplete',function(){
 
    if($('.ls-move-submit-btn').length > 0 &amp;&amp; !$('.ls-move-submit-btn').hasClass('ls-move-next-btn')) {
      $('body').append('<div class="modal fade spinner-modal" data-backdrop="static" data-keyboard="false" tabindex="-1">\
                <div class="modal-dialog modal-sm">\
                  <div class="modal-content" style="width: 100px; padding: 10px 0; text-align:center;">\
                    <span class="fa fa-spinner fa-spin fa-3x" style="font-size: 6em;"></span>\
                  </div>\
                </div>\
              </div>');
 
      $('.ls-move-submit-btn').on('click', function(e) {
        $('.spinner-modal').modal('show');
      });
    }
  });


Also, this spinner image doesn't go off even after submitting Survey. Hence, script display Thank you page but with spinner.

Sorry, I don't know what you are trying to say.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 5 years 7 months ago by tpartner.
The topic has been locked.
  • patecj
  • patecj's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 7 months ago #172420 by patecj
"Also, this spinner image doesn't go off even after submitting Survey. Hence, script display Thank you page but with spinner."

When I clicked submit survey, it takes user to Thank you text message but spinner still is on.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 7 months ago #172430 by tpartner
That's not what I found in testing. Please provide a short test survey.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose