Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: date question type

Re: date question type 3 years 2 weeks ago #66880

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4272
  • Thank you received: 806
  • Karma: 369
But, but, you will be exposed to overwriting when updating...
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: date question type 3 years 2 weeks ago #66881

  • Eddie_V
  • Eddie_V's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 42
  • Thank you received: 2
  • Karma: 1
yes true, but adding more and more code will eventually slow down the application.

We have the limeSurvey source in SVN and before an update we run a diff to see what happend to our modifications. And if still necessary they go into the new version. that way not a single one wil be left behind :)
Last Edit: 3 years 2 weeks ago by Eddie_V.
The administrator has disabled public write access.

Re: date question type 3 years 2 weeks ago #66883

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4272
  • Thank you received: 806
  • Karma: 369
yes true, but adding more and more code will eventually slow down the application.
Not in this case. It is client side code that doesn't run until the page is fully loaded. The date picker already requires a ton of JavaScript to work.
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: date question type 3 years 2 weeks ago #66884

  • Eddie_V
  • Eddie_V's Avatar
  • OFFLINE
  • Senior Lime
  • Posts: 42
  • Thank you received: 2
  • Karma: 1
still it doesnt feel right to add code to "fix" something else in the code
The administrator has disabled public write access.

Re: date question type 3 years 2 weeks ago #66885

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4272
  • Thank you received: 806
  • Karma: 369
That's why jQuery UI allows for dynamic setting of params after initialization - jqueryui.com/demos/datepicker/#option-minDate
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: date question type 3 years 2 weeks 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.

Re: date question type 3 years 2 weeks ago #66933

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4272
  • Thank you received: 806
  • Karma: 369
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;
 
			$('.date').each(function(){
 
				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) );
				}
			});
	});
</script>
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Last Edit: 3 years 2 weeks ago by tpartner.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.169 seconds
Donation Image