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

More
9 months 1 week 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?

Please Log in or Create an account to join the conversation.

LimeSurvey Partners
More
9 months 1 week ago - 9 months 1 week 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.

<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.
Official LimeSurvey Partner - partnersurveys.com
Last edit: 9 months 1 week ago by tpartner.

Please Log in or Create an account to join the conversation.

More
9 months 1 week 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?

Please Log in or Create an account to join the conversation.

More
9 months 1 week 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

Please Log in or Create an account to join the conversation.

More
9 months 1 week ago #172343 by patecj
LimeSurvey
Version 3.13.2+180709

Please Log in or Create an account to join the conversation.

More
9 months 6 days ago - 9 months 6 days 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.

	$(document).on('ready pjax:scriptcomplete',function(){
 
		if($('.ls-move-submit-btn').length > 0 && !$('.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.
Official LimeSurvey Partner - partnersurveys.com
Last edit: 9 months 6 days ago by tpartner.

Please Log in or Create an account to join the conversation.

More
9 months 6 days 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.

Please Log in or Create an account to join the conversation.

More
9 months 6 days 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.
Official LimeSurvey Partner - partnersurveys.com

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!