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

TOPIC: Minimum year > Today

Minimum year > Today 3 years 8 months ago #55814

  • waitz
  • waitz's Avatar
  • OFFLINE
  • Gold Lime
  • Posts: 171
  • Thank you received: 1
  • Karma: 3
I am trying to find a regular expression for the date picker, so that 'Today' is the minimum date. Which I haven't found... Is it possible to use the Advanced Settings -> Minimum year to be greater than 'Today'?
Version 1.91+ Build 11232 | PHP 5.3.9 | MySQL 5.1.56 |
The administrator has disabled public write access.

Re: Minimum year > Today 3 years 8 months ago #55826

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4281
  • Thank you received: 807
  • Karma: 370
You can dynamically set the minimum date after page load. Have a look at the jQery UI datepicker options - 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: Minimum year > Today 3 years 8 months ago #55980

  • waitz
  • waitz's Avatar
  • OFFLINE
  • Gold Lime
  • Posts: 171
  • Thank you received: 1
  • Karma: 3
I looked at it, but I'm not sure how to include jquery in a question type. Are there no regular expressions that can define a date to be no earlier than 'today'?
Version 1.91+ Build 11232 | PHP 5.3.9 | MySQL 5.1.56 |
The administrator has disabled public write access.

Re: Minimum year > Today 3 years 8 months ago #55988

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4281
  • Thank you received: 807
  • Karma: 370
No, I don't think you can do this with regular expressions, you'll need to use JavaScript.

Set up your survey to use JavaScript and place the following script in the source of the date question. Replace "QQ" (line 5) with the ID of the date question.
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		var qID = QQ;
 
		$('#question'+qID+' .popupdate').datepicker( 'option', 'minDate', new Date() );
 
	});
 
</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.
The administrator has disabled public write access.

[SOLVED] Re: Minimum year > Today 3 years 8 months ago #55990

  • waitz
  • waitz's Avatar
  • OFFLINE
  • Gold Lime
  • Posts: 171
  • Thank you received: 1
  • Karma: 3
Great, thanks. Works like a charm :)
Version 1.91+ Build 11232 | PHP 5.3.9 | MySQL 5.1.56 |
The administrator has disabled public write access.

Re: [SOLVED] Re: Minimum year > Today 3 years 8 months ago #56002

  • Mazi
  • Mazi's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 5333
  • Thank you received: 296
  • Karma: 249
Simple but useful solution. Can you add it to the workarounds?

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.

Re: [SOLVED] Re: Minimum year > Today 3 years 8 months ago #56004

  • waitz
  • waitz's Avatar
  • OFFLINE
  • Gold Lime
  • Posts: 171
  • Thank you received: 1
  • Karma: 3
Mazi wrote:
Simple but useful solution. Can you add it to the workarounds?
Not sure if I understand... Is there a limesurvey forum area you want me to add it to, or...?
Version 1.91+ Build 11232 | PHP 5.3.9 | MySQL 5.1.56 |
The administrator has disabled public write access.

Re: [SOLVED] Re: Minimum year > Today 3 years 8 months ago #56007

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4281
  • Thank you received: 807
  • Karma: 370
I'll add it tonight.
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: Minimum year > Today 3 years 8 months ago #56102

  • waitz
  • waitz's Avatar
  • OFFLINE
  • Gold Lime
  • Posts: 171
  • Thank you received: 1
  • Karma: 3
When Tony's script below can define a date to be not earlier than today, and it refers to a question id, it should be possible to set a rule that the date picker has to be later, or the same, than the date in a previous question in the same question group, no?tpartner wrote:
(...)Set up your survey to use JavaScript and place the following script in the source of the date question. Replace "QQ" (line 5) with the ID of the date question.
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() {
 
		var qID = QQ;
 
		$('#question'+qID+' .popupdate').datepicker( 'option', 'minDate', new Date() );
 
	});
 
</script>
This is getting more and more fun ;)
Version 1.91+ Build 11232 | PHP 5.3.9 | MySQL 5.1.56 |
The administrator has disabled public write access.

Re: Minimum year > Today 3 years 8 months ago #56124

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6451
  • Thank you received: 844
  • Karma: 249
Hello,

Maybe you can use docs.jquery.com/UI/Datepicker#option-defaultDate option, with combination with docs.jquery.com/UI/Datepicker/parseDate.

It's just idea :)
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.138 seconds
Donation Image