Current year as maximum for dropdown date question

More
1 month 1 week ago #160198 by tlcutler
tlcutler created the topic: Current year as maximum for dropdown date question
I'm using a date question with display set to dropdown boxes.

I'd like to set the maximum year to the current year so that the top year displayed in the drop down box is the current year instead of 20 years in the future.

I have tried using the "now" function however this sets a validation without restricting the years displayed in the dropdown box. I understand that this is because the year alone should be entered for this type of question.

I've also tried date('Y') which seems to achieve the same result as "now".

Is it possible to use an expression to limit the maximum year displayed for a dropdown boxes date question?

Thanks.

Please Log in to join the conversation.

More
1 month 1 week ago - 1 month 1 week ago #160207 by Joffm
Joffm replied the topic: Current year as maximum for dropdown date question
Hello, tlcutler,

you were nearly right.
You have to set the whole date: date("Y-m-d") in maximum date.

Here the minimum date is hardcoded (2016-06-01) the maximum date dynamically
Best regards
Joffm
Attachments:
Last Edit: 1 month 1 week ago by Joffm.

Please Log in to join the conversation.

More
1 month 1 week ago #160235 by tlcutler
tlcutler replied the topic: Current year as maximum for dropdown date question
Hi Joffm,

Thank you for the reply but unfortunately this only has the same impact as using date("Y") and "now". It sets the validation to the current date but doesn't restrict the years shown in the drop down box.

I'm using version 2.06 of Limesurvey and the citronade template.

Kind regards,
tlcutler
Attachments:

Please Log in to join the conversation.

More
1 month 1 week ago #160243 by Joffm
Joffm replied the topic: Current year as maximum for dropdown date question
Hello, tcutler,
and it works in 2.06 with citronade template as well.

Advanced Settings:


Result:


Seems to be a GIGO-Issue.(Garbage IN - Garbage OUT)
So, please provide your sample (*.lss), that we see what you are trying.

Best regards
Joffm
Attachments:

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!