- Posts: 30
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Automatically proceed to next question after selecting answer
- FSoave
- Offline
- Junior Member
Less
More
3 years 3 days ago #214927
by FSoave
Replied by FSoave on topic Automatically proceed to next question after selecting answer
Hello,
I'm not able to have it working:
the structure:
question group:
- question 1 (a video to be watched)
- question 2 (a yes/no question, mandatory)
question 2 only appears when the video in question 1 has finished playing.
I want to make it so that when the user clicks yes or no in question 2, it proceeds to the following question group.
this is the code I have in question 1
Hello,
I'm not able to havw it working:
the structure:
question group:
- question 1 (a video to be watched)
- question 2 (a yes/no question, mandatory)
question 2 only appears when the video has finished playing.
I want to make it so that when the user clicks yes or no it advances to the following question group.
this is the code I have in question 1
<p style="text-align: center;"><span style="font-size:14px;"><strong>Please watch the video.</strong></span></p>
<p> </p>
<video autoplay="autoplay" controls height="350" id="myvideo" widht="500"><source src="video" type="video/mp4" /> browser does not support this</video>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
var sID = '{SID}'; //survey
var gID = '{GID}'; // group
var qID = '{QID}'; //question
var qID1 =+qID+1;
// Hide the "Next" button
$('#ls-button-submit').hide();
// Hide question blocks
$('#question'+qID1).hide();
var vid = document.getElementById("myvideo");
vid.volume = 0.7;
vid.onended = function() { //when video ends
// Hide video block
$('#question'+qID).hide();
// Show question block
$('#question'+qID1).show();
} //onended
});
</script>
I tried adding the code you gave to both question 1 and question 2 but nothing happens when the yes/no button is clicked. where exactly should I add it? thanks
I'm not able to have it working:
the structure:
question group:
- question 1 (a video to be watched)
- question 2 (a yes/no question, mandatory)
question 2 only appears when the video in question 1 has finished playing.
I want to make it so that when the user clicks yes or no in question 2, it proceeds to the following question group.
this is the code I have in question 1
Hello,
I'm not able to havw it working:
the structure:
question group:
- question 1 (a video to be watched)
- question 2 (a yes/no question, mandatory)
question 2 only appears when the video has finished playing.
I want to make it so that when the user clicks yes or no it advances to the following question group.
this is the code I have in question 1
<p style="text-align: center;"><span style="font-size:14px;"><strong>Please watch the video.</strong></span></p>
<p> </p>
<video autoplay="autoplay" controls height="350" id="myvideo" widht="500"><source src="video" type="video/mp4" /> browser does not support this</video>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
var sID = '{SID}'; //survey
var gID = '{GID}'; // group
var qID = '{QID}'; //question
var qID1 =+qID+1;
// Hide the "Next" button
$('#ls-button-submit').hide();
// Hide question blocks
$('#question'+qID1).hide();
var vid = document.getElementById("myvideo");
vid.volume = 0.7;
vid.onended = function() { //when video ends
// Hide video block
$('#question'+qID).hide();
// Show question block
$('#question'+qID1).show();
} //onended
});
</script>
I tried adding the code you gave to both question 1 and question 2 but nothing happens when the yes/no button is clicked. where exactly should I add it? thanks
The topic has been locked.
- FSoave
- Offline
- Junior Member
Less
More
- Posts: 30
- Thank you received: 0
3 years 2 days ago #214988
by FSoave
Replied by FSoave on topic Automatically proceed to next question after selecting answer
I have to add that I am not using the 'radio' but the 'button group'
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11639
- Thank you received: 2737
3 years 2 days ago #214989
by holch
What is "the button group"? Never heard of that within Limesurvey.
Maybe upload a screenshot, or even better, provide a LSS file of just the relevant questions for this problem (copy your survey, delete everything that is not relevant).
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Automatically proceed to next question after selecting answer
I have to add that I am not using the 'radio' but the 'button group'
What is "the button group"? Never heard of that within Limesurvey.
Maybe upload a screenshot, or even better, provide a LSS file of just the relevant questions for this problem (copy your survey, delete everything that is not relevant).
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.
- Joffm
- Away
- LimeSurvey Community Team
Less
More
- Posts: 12882
- Thank you received: 3965
3 years 2 days ago - 3 years 2 days ago #214994
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Automatically proceed to next question after selecting answer
forget
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 3 years 2 days ago by Joffm.
The topic has been locked.
- FSoave
- Offline
- Junior Member
Less
More
- Posts: 30
- Thank you received: 0
3 years 2 days ago #214996
by FSoave
Replied by FSoave on topic Automatically proceed to next question after selecting answer
Hi, sorry. When you create a Yes/No question, under Display you can choose between "Button Group" or "Radio List".
What element do I have to target in js if I am using the buttons instead of radio?
What element do I have to target in js if I am using the buttons instead of radio?
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
3 years 2 days ago #215007
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Automatically proceed to next question after selecting answer
In version 3.x, with a Yes/No question using button group, this script will trigger the "Next" button.
Sam ple survey attached:
Code:
<script type="text/javascript" data-author="Tony Partner"> $(document).on('ready pjax:scriptcomplete',function(){ $('#question{QID} :radio').on('change', function(e) { $('#ls-button-submit').trigger('click'); }); }); </script>
Sam ple survey attached:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu, jbresnick, FSoave
The topic has been locked.
- jbresnick
- Offline
- New Member
Less
More
- Posts: 1
- Thank you received: 0
2 years 10 months ago - 2 years 10 months ago #216610
by jbresnick
Replied by jbresnick on topic Automatically proceed to next question after selecting answer
This works great! Thanks!
Last edit: 2 years 10 months ago by jbresnick. Reason: changed questions
The topic has been locked.