Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:

THEMA: have Limesurvey go to the next question group when first answer is given

have Limesurvey go to the next question group when first answer is given 1 Jahr 10 Monate her #88477

  • cvandermeij
  • cvandermeijs Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 13
  • Karma: 0
Would it be possible to configure a script that directs the respondent directly to the next page of the survey (question group) once an answer on the previous page has been given? I am working on a survey which has just one question per page. Once a question has been answered, I would like to direct the respondent immediately to the next page of the survey.

Could this be achieved by using Javascript? I have something like this in a text-display element. I am talking about survey ID 948181, question group ID 16 and question ID 96, whereas the text-display element has question ID 108.
<input type="hidden" name="948181X16X108" id ="948181X16X108" value="" />
<script type="text/javascript">
<!--
    //Change the elements of the arrray to the varnames of your question
    var answerItems = new Array('948181X16X96');
    //Change this to the the varname of the text-display variable
    var idOfInputField = '948181X16X108';
 
    function submitform()
    {
        document.f1.submit();
    }
 
-->
</script>
Letzte Änderung: 1 Jahr 10 Monate her von cvandermeij.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: have Limesurvey go to the next question group when first answer is given 1 Jahr 10 Monate her #88488

  • DenisChenu
  • DenisChenus Avatar
  • OFFLINE
  • Moderator Lime
  • Beiträge: 6362
  • Dank erhalten: 827
  • Karma: 245
Hello,

For radio single choice question list:
<script>
$(function() {
$("#question{QID} input.radio").click(function(){
$("#movenextbtn").click();
});
}); 
</script>
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: have Limesurvey go to the next question group when first answer is given 1 Jahr 10 Monate her #88489

  • cvandermeij
  • cvandermeijs Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 13
  • Karma: 0
Thanks Dennis, this works great! Do you also know where I should put the code to hide the next/submit button for pages where I use the 'click is next page'.

It should contain something like this I suppose

$('#movesubmitbtn, #movenextbtn').attr('disabled', 'disabled');
Letzte Änderung: 1 Jahr 10 Monate her von cvandermeij.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: have Limesurvey go to the next question group when first answer is given 1 Jahr 10 Monate her #88490

  • DenisChenu
  • DenisChenus Avatar
  • OFFLINE
  • Moderator Lime
  • Beiträge: 6362
  • Dank erhalten: 827
  • Karma: 245
Put in in a specific class (see navigator.pstpl) and hide it in css.
(and NO attr disabled)

Denis
PS: api.jquery.com/hide/
Letzte Änderung: 1 Jahr 10 Monate her von DenisChenu. Begründung: http://api.jquery.com/hide/
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: have Limesurvey go to the next question group when first answer is given 1 Jahr 10 Monate her #88491

  • cvandermeij
  • cvandermeijs Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 13
  • Karma: 0
Hi Dennis, thanks again. But I would like to enable the next/submit button for some pages (with just informational text) and disable it for radio button questions. How would I make a distinction between enable/disable?

Thanks.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: have Limesurvey go to the next question group when first answer is given 1 Jahr 10 Monate her #88492

  • DenisChenu
  • DenisChenus Avatar
  • OFFLINE
  • Moderator Lime
  • Beiträge: 6362
  • Dank erhalten: 827
  • Karma: 245
.hide it in javascript. If button is deactivated , the .click do nothing.
(you can addClass too).

Denis
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Re: have Limesurvey go to the next question group when first answer is given 1 Jahr 10 Monate her #88495

  • cvandermeij
  • cvandermeijs Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 13
  • Karma: 0
Hi Denis, great. It is working. Thanks.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Moderatoren: ITEd
Ladezeit der Seite: 0.196 Sekunden
Donation Image