Check out the LimeSurvey source code on GitHub!

dynamic relevance with onkeychange

More
4 years 11 months ago #76884 by dreier
Hey,

i am using Limesurvey 1.92. Actually i want to use the dynamic relevance to ask how many children someone has and to show some following questions dynamically depending on the answer.
Now the problem is, that u have to unfocus the text field to get the next questions. This happens for sure because it is an onchange()-Event
-> Is it possible to change this to onkeyup()-Events?

Here the code of the Expression Manager Example
<input id="javakids" type="text" onchange="checkconditions(this.value, this.name, this.type)" value="" name="kids">

Is there any script to change the onchange to onkeyup?

Thanks
dreier

Please Log in to join the conversation.

More
4 years 10 months ago #77755 by TMSWhite
If the person tabs off of the question, the new questions will dynamically display and the tab focus will land on the next question.

LS used to use onkeyup for some question types, but each one required a call to checkconditions. That was resulting in very slow behavior for complex pages (especially in some browsers). Thus the change to using onchange events instead.

Please Log in to join the conversation.

More
4 years 10 months ago #77758 by dreier
Hello,

I already noticed that the person can use the tab to jump from question to question. The problem is that not every participant of a survey will be able to use this key, because not everyone know where it is :blink:
Okay that does explain the change - thanks for the info. I just added a Button in the questionhelp so that the user will be forced to click anywhere else.

Cheers
dreier

Please Log in to join the conversation.

More
4 years 10 months ago #77782 by tpartner
You can add your own keyup event handlers to the source of the question or to template.js to call checkconditions().

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form