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

  • BillLenoir
  • BillLenoir's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 11 months ago #133901 by BillLenoir
Entering a Year, but not one in the future was created 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.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 11 months ago #133944 by tpartner
Replied by tpartner on topic Entering a Year, but not one in the future
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.

Lime-years ahead

Online-surveys for every purse and purpose