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

TOPIC: date question type

date question type 4 years 9 months ago #66856

  • Eddie_V
  • Eddie_V's Avatar
  • Offline
  • Senior Lime
  • Posts: 42
  • Thank you received: 2
  • Karma: 1
I see that whenever I put a dae question into a survey the minimal year is set to 1980 and max is 2020. I can override that by putting my own min/max year into the question settings.

My question is, where can I chance this default 1980 to a different year.

greetings
Eddie_V
The administrator has disabled public write access.

date question type 4 years 9 months ago #66859

  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5974
  • Thank you received: 366
  • Karma: 260
I think that is hardcoded at the core files. That's why we offer the ability to change it by setting an according question attribute.

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.

date question type 4 years 9 months ago #66860

  • Eddie_V
  • Eddie_V's Avatar
  • Offline
  • Senior Lime
  • Posts: 42
  • Thank you received: 2
  • Karma: 1
yeah, thats why i wanted to know where in the core files, since I cannot find it. I got a survey with alot of date fields (day of birth to be precise) and I wanted to see if I could chance them all at once.

also it would be nice to just set it to something much earlier then 1980 otherwise I will be getting this question myself by users in the future :)
The administrator has disabled public write access.

date question type 4 years 9 months ago #66862

  • Eddie_V
  • Eddie_V's Avatar
  • Offline
  • Senior Lime
  • Posts: 42
  • Thank you received: 2
  • Karma: 1
ok I found it, its in qanda.php and I changed it to 1920 so problem solved. (searching for 1980 into 3605 files took some time :))

But what I did notice is that the default min year was 1980 unless you would set: # Display dropdown boxes to Yes as a question attribute then the default min year is 1900 in the code.

Is there a reason that those 2 have a different min year as default?
Last Edit: 4 years 9 months ago by Eddie_V.
The administrator has disabled public write access.

date question type 4 years 9 months ago #66863

  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5974
  • Thank you received: 366
  • Karma: 260
Eddie_V wrote:
But what I did notice is that the default min year was 1980 unless you would set: # Display dropdown boxes to Yes as a question attribute then the default min year is 1900 in the code.

Is there a reason that those 2 have a different min year as default?
Nope, please open a ticket at the bugtracker and...
  1. Give as much information as possible
  2. Attach your survey. You can mark your ticket "private" so that only the developers will be able to take a look at it.
  3. Provide step-by-step instructions how to reproduce the problem.
  4. If possible/helpful please provide screenshots

Afterwards please post the link to the bugtracker so we can follow the progress.

Thanks!

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.

date question type 4 years 9 months ago #66866

  • Eddie_V
  • Eddie_V's Avatar
  • Offline
  • Senior Lime
  • Posts: 42
  • Thank you received: 2
  • Karma: 1
done: bugs.limesurvey.org/view.php?id=5496

fyi, your link to the Bugtracker is outdated.
The administrator has disabled public write access.

date question type 4 years 9 months ago #66869

  • Mazi
  • Mazi's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5974
  • Thank you received: 366
  • Karma: 260
Thanks for notifying. We'll setup a redirect.

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.

date question type 4 years 9 months ago #66875

  • Eddie_V
  • Eddie_V's Avatar
  • Offline
  • Senior Lime
  • Posts: 42
  • Thank you received: 2
  • Karma: 1
your welcome, and thanks to you aswell for your fast replies
The administrator has disabled public write access.

date question type 4 years 9 months ago #66876

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6122
  • Thank you received: 1357
  • Karma: 533
You can use JavaScript to set the minimum (and maximum) date without hacking the core code.

This workaround explains how to do it on a per-question basis - docs.limesurvey.org/tiki-index.php?page_...m_Date_in_Datepicker. With a little modification and placing the code in template.js, it could be used to control all date questions.
	$(document).ready(function() {
 
		$('.popupdate').datepicker( 'option', 'minDate', new Date(1920, 1-1, 1) );
 
	});
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The administrator has disabled public write access.

date question type 4 years 9 months ago #66879

  • Eddie_V
  • Eddie_V's Avatar
  • Offline
  • Senior Lime
  • Posts: 42
  • Thank you received: 2
  • Karma: 1
thank you for your suggestion Tony.

But I rather alter the core code instead of adding more code
The administrator has disabled public write access.

date question type 4 years 9 months ago #66880

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6122
  • Thank you received: 1357
  • Karma: 533
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.
The administrator has disabled public write access.

date question type 4 years 9 months 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: 4 years 9 months ago by Eddie_V.
The administrator has disabled public write access.

date question type 4 years 9 months ago #66883

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6122
  • Thank you received: 1357
  • Karma: 533
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.
The administrator has disabled public write access.

date question type 4 years 9 months 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.

date question type 4 years 9 months ago #66885

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6122
  • Thank you received: 1357
  • Karma: 533
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.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.373 seconds
Imprint                   Data Protection Statement                  Revocation information and revocation form