Welcome to the LimeSurvey Community Forum

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

Entering a Year, but not one in the future

More
9 years 5 months ago #133901 by BillLenoir
I have a numerical input field for the survey respondents to enter a year. I want to make sure that year is not in the future. How can I use expression manager in the question validation to ensure this?

I do not want to set the maximum value to 2016, because this survey will be run again in 2017.
The topic has been locked.
More
9 years 5 months ago #133944 by tpartner
You can use the Expression Manager date() function with a "Y" format to return the current year. So, for example, if you have question code "Q1", the validation equation would be:

Code:
Q1 <= date('Y',strtotime('now'))

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: BillLenoir
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose