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

More
6 years 2 months ago #164565 by csknfrt
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
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 2 months ago #164567 by tpartner
This will work in the 5 point choice (stars) type question:

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.
More
6 years 2 months ago #164575 by csknfrt
Thank you tpartner for your support. it works perfect.
The topic has been locked.
More
6 years 2 months ago #164662 by csknfrt
Hello again,

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
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 2 months ago #164691 by tpartner
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
  • Siem's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 9 months ago #171521 by Siem

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
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 9 months ago #171522 by Joffm
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

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
  • Siem's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 9 months ago #171523 by Siem
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:
Code:
$(document).ready(function(){ 
  $('#question{QID} input[type="radio"]').on('click', function() {
    $('#ls-button-submit').trigger('click');
  });
});
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 9 months ago #171524 by Joffm
Hi,

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
  • Siem's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 9 months ago - 5 years 9 months ago #171526 by Siem

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
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 9 months ago #171538 by tpartner
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.
More
5 years 6 months ago #175426 by surveySn
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.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose