Check out the LimeSurvey source code on GitHub!

Minimum year > Today

More
6 years 3 weeks ago #55814 by waitz
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 |

Please Log in to join the conversation.

More
6 years 3 weeks ago #55826 by tpartner
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.

Please Log in to join the conversation.

More
6 years 3 weeks ago #55980 by waitz
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 |

Please Log in to join the conversation.

More
6 years 3 weeks ago #55988 by tpartner
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.

Please Log in to join the conversation.

More
6 years 3 weeks ago #55990 by waitz
Great, thanks. Works like a charm :)

Version 1.91+ Build 11232 | PHP 5.3.9 | MySQL 5.1.56 |

Please Log in to join the conversation.

More
6 years 3 weeks ago #56002 by Mazi
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)survey-consulting.com'"

Please Log in to join the conversation.

More
6 years 3 weeks ago #56004 by waitz

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 |

Please Log in to join the conversation.

More
6 years 3 weeks ago #56007 by tpartner
I'll add it tonight.

Cheers,
Tony Partner

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

Please Log in to join the conversation.

More
6 years 3 weeks ago #56102 by waitz
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 |

Please Log in to join the conversation.

More
6 years 3 weeks ago #56124 by DenisChenu
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 :)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form