dynamic relevance with onkeychange

More
5 years 2 months ago #76884 by dreier
dreier created the topic: dynamic relevance with onkeychange
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
5 years 1 month ago #77755 by TMSWhite
TMSWhite replied the topic: dynamic relevance with onkeychange
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
5 years 1 month ago #77758 by dreier
dreier replied the topic: dynamic relevance with onkeychange
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
5 years 1 month ago #77782 by tpartner
tpartner replied the topic: dynamic relevance with onkeychange
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.

Start now!

Just create your account and start using Limesurvey today.

Register now