- Posts: 25
- 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
- tomtom
- Offline
- Junior Member
Less
More
6 years 5 months ago #160964
by tomtom
Replied by tomtom on topic Automatically proceed to next question after selecting answer
Hi Joffm and Tony. Thank you for your kindness, it is exactly what I want! If participant say NO, they will be auto passed to next, so for YES answers, participant should spend more time on thinking the likert scale answers. Great!!!
The topic has been locked.
- csknfrt
- Offline
- New Member
Less
More
- Posts: 19
- Thank you received: 1
6 years 2 months ago #164547
by csknfrt
Replied by csknfrt on topic Automatically proceed to next question after selecting answer
Hello,
I tried with radio question but it didn't work. (LS 3.4.2+180223)
I tried with radio question but it didn't work. (LS 3.4.2+180223)
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ $('#question{QID} input.radio').click(function() { checkconditions($(this).attr('value'), $(this).attr('name'), $(this).attr('type')); $('#movenextbtn, #movesubmitbtn').trigger('click'); }); $('#question{QID} .label-clickable').unbind(); $('#question{QID} .label-clickable').click(function() { $('#question{QID} input.radio').unbind(); var input = $(this).parent().find('input.radio'); $(input).trigger('click'); checkconditions($(input).attr('value'), $(input).attr('name'), $(input).attr('type')); $('#movenextbtn, #movesubmitbtn').trigger('click'); }); }); </script>
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3593
6 years 2 months ago #164553
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
Try this for 3.4.x:
Code:
<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ $('#question{QID} input[type="radio"]').on('click', function() { $('#ls-button-submit').trigger('click'); }); }); </script>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- csknfrt
- Offline
- New Member
Less
More
- Posts: 19
- Thank you received: 1
6 years 2 months ago #164558
by csknfrt
Replied by csknfrt on topic Automatically proceed to next question after selecting answer
Thank you tpartner it is working perfect! I have 2 question.
- May I use other question types like stars and slider?
- May I hide next, previous or send button on the question when i use this solition?
- May I use other question types like stars and slider?
- May I hide next, previous or send button on the question when i use this solition?
The topic has been locked.
- csknfrt
- Offline
- New Member
Less
More
- Posts: 19
- Thank you received: 1
6 years 2 months ago #164565
by csknfrt
Replied by csknfrt on topic Automatically proceed to next question after selecting answer
I found answer to my second question but I still don't know answer of first question.
Code:
<script> $(document).ready(function() { $('#ls-button-previous').hide(); }); </script> <script> $(document).ready(function() { $('#ls-button-submit').hide(); }); </script>
csknfrt wrote: Thank you tpartner it is working perfect! I have 2 question.
- May I use other question types like stars and slider?
- May I hide next, previous or send button on the question when i use this solition?
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3593
6 years 2 months ago #164567
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
This will work in the 5 point choice (stars) type question:
This will work in sliders:
This will hide all navigation buttons:
Code:
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ $('#question{QID} input[type="radio"]').on('change', function() { setTimeout(function() { $('#ls-button-submit').trigger('click'); }, 250); }); }); </script>
This will work in sliders:
Code:
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ $('#question{QID} input[type="text"]').on('slideStop', function(e){ $('#ls-button-submit').trigger('click'); }); }); </script>
This will hide all navigation buttons:
Code:
<script type="text/javascript" charset="utf-8"> $(document).on('ready pjax:scriptcomplete',function(){ $('#navigator-container button').hide(); }); </script>
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- csknfrt
- Offline
- New Member
Less
More
- Posts: 19
- Thank you received: 1
6 years 2 months ago #164575
by csknfrt
Replied by csknfrt on topic Automatically proceed to next question after selecting answer
Thank you tpartner for your support. it works perfect.
The topic has been locked.
- csknfrt
- Offline
- New Member
Less
More
- Posts: 19
- Thank you received: 1
6 years 2 months ago #164662
by csknfrt
Replied by csknfrt on topic Automatically proceed to next question after selecting answer
Hello again,
I see the js code in the "Response submission for survey Survey with results" mail. is it normal?
I see the js code in the "Response submission for survey Survey with results" mail. is it normal?
Code:
Hello, A new response was submitted for your survey 'Survey'. Click the following link to see the individual response: http://www.musterimonemli.com/surveyx/index.php/admin/responses/sa/view/surveyid/784213/id/413 Click the following link to edit the individual response: http://www.musterimonemli.com/surveyx/index.php/admin/dataentry/sa/editdata/subaction/edit/surveyid/784213/id/413 View statistics by clicking here: http://www.musterimonemli.com/surveyx/index.php/admin/statistics/sa/index/surveyid/784213 The following answers were given by the participant: Yanıt kodu 413 Gönderildiği tarih 27.02.2018 12:55:50 Son bakılan sayfa 1 Başlangıç dili tr Tohum 575216181 Başlangıç tarihi 27.02.2018 12:55:48 Son işlem tarihi 27.02.2018 12:55:50 IP Adresi 95.10.195.105 Gelinen İnternet Adresi http://www.musterimonemli.com/surveyx/index.php/admin/survey/sa/view/surveyid/784213 Travel1 How ofter do you go to the travel? $(document).on('ready pjax:scriptcomplete',function(){ $('#navigator-container button').hide(); }); $(document).ready(function(){ $('#question input[type="radio"]').on('click', function() { $('#ls-button-submit').trigger('click'); }); }); Yes [A1][ Did you go to the travel last summer? $(document).ready(function() { $('#ls-button-previous').hide(); }); $(document).ready(function() { $('#ls-button-submit').hide(); }); $(document).ready(function(){ $('#question input[type="radio"]').on('click', function() { $('#ls-button-submit').trigger('click'); }); });
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3593
6 years 2 months ago #164691
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 my opinion, that is a bug. I have reported it -
bugs.limesurvey.org/view.php?id=13424
.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- Siem
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 55
- Thank you received: 1
5 years 9 months ago #171521
by Siem
I upgraded from Version 2.x to Version 3.13.2+180709, obviously the original V2 code didn't work anymore.
Unfortunately the above solution doesn't do the trick for me either. I tried adding it to head.twig, custom_header.twig and nav_bar.twig and it shows up in the source code.
Am I adding it to the wrong file, if not how can I get this to work?
Replied by Siem on topic Automatically proceed to next question after selecting answer
tpartner wrote: Try this for 3.4.x:
Code:<script type="text/javascript" charset="utf-8"> $(document).ready(function(){ $('#question{QID} input[type="radio"]').on('click', function() { $('#ls-button-submit').trigger('click'); }); }); </script>
I upgraded from Version 2.x to Version 3.13.2+180709, obviously the original V2 code didn't work anymore.
Unfortunately the above solution doesn't do the trick for me either. I tried adding it to head.twig, custom_header.twig and nav_bar.twig and it shows up in the source code.
Am I adding it to the wrong file, if not how can I get this to work?
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12944
- Thank you received: 3979
5 years 9 months ago #171522
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
Hi, siam,
it is a Javascript snippet.
So you should put it into an Javascript file, here I should say, the "custom.js" of your template is the right place.
Best regards
Joffm
it is a Javascript snippet.
So you should put it into an Javascript file, here I should say, the "custom.js" of your template is the right place.
Best regards
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: Siem
The topic has been locked.
- Siem
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 55
- Thank you received: 1
5 years 9 months ago #171523
by Siem
Replied by Siem on topic Automatically proceed to next question after selecting answer
Thanks Joff, I put it in the Javascript file, but then I get this error:
Error: Syntax error, unrecognized expression: #question{QID} input[type="radio"]
I tried it with and without the <script> tags:
Error: Syntax error, unrecognized expression: #question{QID} input[type="radio"]
I tried it with and without the <script> tags:
Code:
$(document).ready(function(){ $('#question{QID} input[type="radio"]').on('click', function() { $('#ls-button-submit').trigger('click'); }); });
The topic has been locked.