Entering a Year, but not one in the future

More
3 years 4 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.

Please Log in or Create an account to join the conversation.

More
3 years 4 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:

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

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
The following user(s) said Thank You: BillLenoir

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!