- Posts: 19
- Thank you received: 1
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
- csknfrt
- Offline
- New Member
Less
More
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: 10114
- Thank you received: 3595
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: 10114
- Thank you received: 3595
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: 12994
- Thank you received: 3996
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.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12994
- Thank you received: 3996
5 years 9 months ago #171524
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,
I put it into the question text (source code mode) and it works.
Joffm
I put it into the question text (source code mode) and it works.
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 - 5 years 9 months ago #171526
by Siem
You are right, that was the trick many thanks!
I would like to add this code to my theme so it is automatically added to the questions, would this be possible?
It would save a lot of time, since there are multiple tests that need it.
Replied by Siem on topic Automatically proceed to next question after selecting answer
Joffm wrote: Hi,
I put it into the question text (source code mode) and it works.
Joffm
You are right, that was the trick many thanks!
I would like to add this code to my theme so it is automatically added to the questions, would this be possible?
It would save a lot of time, since there are multiple tests that need it.
Last edit: 5 years 9 months ago by Siem.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10114
- Thank you received: 3595
5 years 9 months ago #171538
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
If want it to act on EVERY list-radio question in every survey using that template, add this to your theme custom.js file:
Code:
$(document).on('ready pjax:scriptcomplete',function(){ $('.list-radio input[type="radio"]').on('click', function() { $('#ls-button-submit').trigger('click'); }); });
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: Siem, NESTSurvey, joeliu916
The topic has been locked.
- surveySn
- Offline
- Premium Member
Less
More
- Posts: 136
- Thank you received: 4
5 years 6 months ago #175426
by surveySn
Replied by surveySn on topic Automatically proceed to next question after selecting answer
Hello tpartner
I have some question,
Can this be used in Arrays?
This will hide all navigation buttons:
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:scriptcomplete',function(){
$('#navigator-container button').hide();
});
</script>
But this code hides all next, can you hide only one problem page's next?
We look forward to your reply! Thank you.
I have some question,
Can this be used in Arrays?
This will hide all navigation buttons:
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:scriptcomplete',function(){
$('#navigator-container button').hide();
});
</script>
But this code hides all next, can you hide only one problem page's next?
We look forward to your reply! Thank you.
The topic has been locked.