Show "Submit" Button AFTER "Yes" (Radio or Yes/no) v3.15.9

More
3 years 3 months ago - 3 years 3 months ago #181065 by UdoHolzmann
Hi. I have seen this issue discussed with earlier versions of LS. I am using 3.15.9.

At the very end of my survey (last question of last group), I want the user to confirm that they are ready to submit their Information after clicking "Yes" using a radio button or Yes/No box option.

Any ideas on the JavaScript needed for this?

Thanks.
Last edit: 3 years 3 months ago by UdoHolzmann.
The topic has been locked.
More
3 years 3 months ago #181067 by Joffm
Hi,

what do you want to happen if the user clicks "No"?

Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
More
3 years 3 months ago #181068 by UdoHolzmann
The "Submit" button should remain hidden. Thanks.
The topic has been locked.
More
3 years 3 months ago #181129 by UdoHolzmann
The topic has been locked.
More
3 years 3 months ago #181149 by tpartner
If using a Yes/No type question, you can add a script like this to the question source:

<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		// Hide the submit button
		$('#ls-button-submit').hide();
 
		// Listener on the yes/no answers
		$('#question{QID} input:radio').on('change', function(e) {
			if($('#question{QID} input:radio:checked:eq(0)').val() == 'Y') {
				$('#ls-button-submit').fadeIn(500);
			}
			else {
				$('#ls-button-submit').fadeOut(500);
			}
		});
	});	
</script>

Sample survey attached:

File Attachment:

File Name: limesurvey...2-28.lss
File Size:28 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
The following user(s) said Thank You: NoraSalasIllanes
The topic has been locked.
More
3 years 3 months ago #181151 by UdoHolzmann
Thanks. I will give this a try. Dumb question: where is the question source? You mean click "source" in the text box where I write my question and paste there?
The topic has been locked.
More
3 years 3 months ago #181153 by tpartner
See this article about how to add JavaScript - manual.limesurvey.org/Workarounds:_Manip...tc..29_in_LimeSurvey

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
3 years 3 months ago #181154 by UdoHolzmann
Thanks. That helps a lot.

In your code above, do I have to edit "#question{QID}" to "#question1234"?
The topic has been locked.
More
3 years 3 months ago #181158 by tpartner
Nope, the {QID} placeholder will automatically return the question ID.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
3 years 3 months ago #181164 by UdoHolzmann
Awesome. It does work. Thank you much!
The topic has been locked.
More
3 years 2 months ago #182505 by tpartner
That does not target a specific question.

Cheers,
Tony Partner

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

Start now!

Just create your account and start using Limesurvey today.

Register now