Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Tab and Enter keys

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 9 months ago #139623 by DenisChenu
Replied by DenisChenu on topic Tab and Enter keys

adridg wrote:

DenisChenu wrote: Or just remove the line 80 to 84


Didn´t work for FireFox and Chrome.

It's not an answer .....

Put this at top of your template.js file
Code:
$(document).on('keypress','input[type=text],#limesurvey select',function(e){
    var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
    if (key == 13) {
      e.preventDefault();
    }
  });

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: adridg, ConradNg
The topic has been locked.
More
4 years 6 months ago - 4 years 6 months ago #190018 by Diegoteca
Replied by Diegoteca on topic Tab and Enter keys

Bigred01 wrote: To trigger the next button, try this.

Code:
$(document).ready(function() {
    $('input').on('keydown keypress', function(e) {       
        if(e.keyCode === 13) {
            e.preventDefault();
      $('#movenextbtn').click();
        }      
    });
});



Hello! I am working with 3.17.9 + 190731 and with the Bootswatch theme.

The code above works great for me. I copied this in "Files.js" of advanced options.

But I have a problem with the numerical questions when the following questions (also numerical) have to be hidden / shown according to conditional fork. More precisely, with some numbers when I press "enter" it goes right to the immediate next question. But for the options that I need to "skip" two or more questions these are actually "hidden" and the correct question appears below but the cursor remains on the initial question. One fact: if "tab" is pressed, the cursor effectively points to the desired question.


Is it as if the code above would be useful for "movenextbtn" and maybe when there are jumps, another command must be added?

First, I thought the problem was my misuse of the configuration condition, but the logical file shows no problem.

In the example that I attach if you put a number other than 1 in the first question and press "enter" you should skip to the last question. The other questions are effectively hidden but the cursor only jumps with the "Tab" key.

Thanks in advance,
Diego
Last edit: 4 years 6 months ago by Diegoteca.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose