- Posts: 58
- Thank you received: 9
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
- eloner
- Topic Author
- Offline
- Senior Member
Less
More
8 years 4 months ago #129237
by eloner
NUMERICAL INPUT. DIFFERENT RANGE FOR HOURS AND MINUTES was created 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:
Any suggestions are more than welcome!
Best regards,
Elo
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:
Any suggestions are more than welcome!
Best regards,
Elo
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
8 years 4 months ago #129246
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic NUMERICAL INPUT. DIFFERENT RANGE FOR HOURS AND MINUTES
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:
And something like this in the "Question validation tip" field:
Here's a modified version of your question:
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:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
The following user(s) said Thank You: eloner
The topic has been locked.
- eloner
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 58
- Thank you received: 9
8 years 4 months ago #129251
by eloner
Replied by eloner on topic NUMERICAL INPUT. DIFFERENT RANGE FOR HOURS AND MINUTES
Perfect!
Thanmk you Tony!
Cheers,
Elo
Thanmk you Tony!
Cheers,
Elo
The topic has been locked.