Welcome, Guest
Username: Password: Remember me

TOPIC: dynamic relevance with onkeychange

dynamic relevance with onkeychange 2 years 7 months ago #76884

  • dreier
  • dreier's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 24
  • Thank you received: 2
  • Karma: 3
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
The administrator has disabled public write access.

Re: dynamic relevance with onkeychange 2 years 6 months ago #77755

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
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.
The administrator has disabled public write access.

Re: dynamic relevance with onkeychange 2 years 6 months ago #77758

  • dreier
  • dreier's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 24
  • Thank you received: 2
  • Karma: 3
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
The administrator has disabled public write access.

Re: dynamic relevance with onkeychange 2 years 6 months ago #77782

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4271
  • Thank you received: 805
  • Karma: 369
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.113 seconds
Donation Image