- Posts: 2
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Current year as maximum for dropdown date question
- tlcutler
- Topic Author
- Offline
- New Member
Less
More
6 years 5 months ago #160198
by tlcutler
Current year as maximum for dropdown date question was created by tlcutler
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.
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.
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12908
- Thank you received: 3970
6 years 5 months ago - 6 years 5 months ago #160207
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on 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
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
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
Last edit: 6 years 5 months ago by Joffm.
The topic has been locked.
- tlcutler
- Topic Author
- Offline
- New Member
Less
More
- Posts: 2
- Thank you received: 0
6 years 5 months ago #160235
by tlcutler
Replied by tlcutler on 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
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:
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12908
- Thank you received: 3970
6 years 5 months ago #160243
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on 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
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
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
The topic has been locked.
- blocka
- Offline
- Platinum Member
Less
More
- Posts: 409
- Thank you received: 34
6 years 3 months ago #162798
by blocka
Replied by blocka on topic Current year as maximum for dropdown date question
Any suggestions on how to specify a max date of the current date, less 18 years (it's for a date of birth field): no one under 18 will complete my survey...
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10103
- Thank you received: 3591
6 years 3 months ago #162813
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 Current year as maximum for dropdown date question
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
The topic has been locked.
- mrli999
- Offline
- Premium Member
Less
More
- Posts: 146
- Thank you received: 2
5 years 1 month ago #181915
by mrli999
Replied by mrli999 on topic Current year as maximum for dropdown date question
I am using 2.06. I entered (date('Y')-18)+'-'+(date('m'))+'-'+(date('d')) for the maximum date, but it didn't work. Any other solution?
Thanks.
Thanks.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13624
- Thank you received: 2490
5 years 1 month ago #181922
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Current year as maximum for dropdown date question
Maybe "18 years ago" BUT : 2.06 : totally unsure it work. Get (at minimum) a 2.6lts version :
github.com/SondagesPro/LimeSurvey-SondagesPro
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.