Welcome to the LimeSurvey Community Forum

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

Restrict Future Dates using Date question type.

  • LSCitizen
  • LSCitizen's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
10 years 8 months ago - 10 years 8 months ago #97612 by LSCitizen
Hello-
I would like to restrict users from entering future dates by using the Date question type.
When I enter the current year as the Maximum Year, users are able to view and select a future date. Is there a way to restrict this using JavaScript or jQuery? I would like for users to be able to select the current date and any past date.

Thanks

I currently using: Version 1.92+ Build 120620
Last edit: 10 years 8 months ago by LSCitizen. Reason: Needed to add more information.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 years 8 months ago #97661 by tpartner
Add this to the question source:
Code:
<script type="text/javascript" charset="utf-8">  
  $(document).ready(function(){
    $('#question{QID} .popupdate').datepicker( 'option', 'maxDate', new Date() );
  });
</script>

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: LSCitizen
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose