Welcome to the LimeSurvey Community Forum

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

NUMERICAL INPUT. DIFFERENT RANGE FOR HOURS AND MINUTES

More
10 years 10 months ago #129237 by eloner
Hello,
I am using LS 2.06+ Build 151205.
I have a question "How long do you take to go home from school?" where I ask for hours and minutes.
Here is an example:

I am wondering if it's possible to set up two different ranges (i.e. min and max value) for the minutes and for the hours (i..e. for the minutes: minimum 0 and maximum 60 and for the hours: 0 and 5) in the same question.
The code is here:

File Attachment:

File Name: limesurvey...1354.lsq
File Size:4.32 KB

Any suggestions are more than welcome!
Best regards,
Elo
The topic has been locked.
More
10 years 10 months ago #129246 by tpartner
If you don't use the same sub-question codes for x and y axis (for example, use A1 and A2 for x-axis), you can add something like this to the "Question validation equation" field:
Code:
self.sq_A1 >= 0 && self.sq_A1 < 6 && self.sq_A2 >= 0 && self.sq_A2 < 61

And something like this in the "Question validation tip" field:
Code:
{if(self.sq_A1 >= 0 && self.sq_A1 < 6 && self.sq_A2 >= 0 && self.sq_A2 < 61, '', 'Hours must be between 0 and 5 and minutes between 0 and 60')}

Here's a modified version of your question:

File Attachment:

File Name: limesurvey...7243.lsq
File Size:4.97 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: eloner
The topic has been locked.
More
10 years 10 months ago #129251 by eloner
Perfect!
Thanmk you Tony!
Cheers,
Elo
The topic has been locked.
Moderators: tpartner, holch

Lime-years ahead

Online-surveys for every purse and purpose