Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:
  • Page:
  • 1
  • 2

TOPIC: date question type

date question type 5 years 2 months ago #66886

  • Eddie_V
  • Eddie_V's Avatar
  • Offline
  • Senior Lime
  • Posts: 42
  • Thank you received: 2
  • Karma: 1
it didn't redirect me corretly but I found what you ment.

one question tho, what would happen if a user in limesurvey would set a min date in the attributes, would that still override the date I set in the template.js?

I dont have the source code here at home, so I cannot do a quick test, but if it still works that way I will try/implement your suggestion.
The administrator has disabled public write access.

date question type 5 years 2 months ago #66933

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6574
  • Thank you received: 1477
  • Karma: 579
Well, it turns out that my fix does take precedence over the advanced settings so we need a test to see if the admin set those.

This script will set a new minimum and maximum year for all date questions that do not have the "Minimum year" or "Maximum year" advanced settings changed.
<script type="text/javascript" charset="utf-8">
	$(document).ready(function() {
			var newMinYear = 1920;
			var newMaxYear = 2030;
				var qYearRange = $('input[id^="dateyearrange"]', this).val();
				if(qYearRange == '1980:2020') {
					$('.popupdate', this).datepicker( 'option', "yearRange", ''+newMinYear+':'+newMaxYear+'' );
					$('.popupdate', this).datepicker( 'option', 'minDate', new Date(newMinYear, 1-1, 1) );
					$('.popupdate', this).datepicker( 'option', 'maxDate', new Date(newMaxYear, 1-1, 1) );
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last Edit: 5 years 2 months ago by tpartner.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Time to create page: 0.200 seconds
Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form