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

More
3 months 3 weeks ago #172319 by patecj
patecj created the topic: While giving survey, Clicking on Submit, doesnt refresh page immediately
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.

More
3 months 3 weeks ago - 3 months 3 weeks ago #172322 by tpartner
tpartner replied the topic: While giving survey, Clicking on Submit, doesnt refresh page immediately
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.
Last Edit: 3 months 3 weeks ago by tpartner.

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

More
3 months 3 weeks ago #172340 by patecj
patecj replied the topic: While giving survey, Clicking on Submit, doesnt refresh page immediately
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
3 months 3 weeks ago #172342 by jelo
jelo replied the topic: While giving survey, Clicking on Submit, doesnt refresh page immediately
What LimeSurvey version is used?

Are you a student conducting a survey? If yes, tell me why you use LimeSurvey?
www.limesurvey.org/forum/development/116...y-you-use-limesurvey

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

More
3 months 3 weeks ago #172343 by patecj
patecj replied the topic: While giving survey, Clicking on Submit, doesnt refresh page immediately
LimeSurvey
Version 3.13.2+180709

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

More
3 months 3 weeks ago - 3 months 3 weeks ago #172405 by tpartner
tpartner replied the topic: While giving survey, Clicking on Submit, doesnt refresh page immediately

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.
Last Edit: 3 months 3 weeks ago by tpartner.

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

More
3 months 3 weeks ago #172420 by patecj
patecj replied the topic: While giving survey, Clicking on Submit, doesnt refresh page immediately
"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
3 months 3 weeks ago #172430 by tpartner
tpartner replied the topic: While giving survey, Clicking on Submit, doesnt refresh page immediately
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.

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!