Check out the LimeSurvey source code on GitHub!

limit period of time in date field

More
4 years 8 months ago #81529 by MPIDR
I have a survey with a date field and would like to limit the period of time that can be chosen. Can this be done?

In the advanced settings, only the minimum and maximum year can be set. However, I'd like to limit the selection to something like August 13th until August 25th.

Regards
MPIDR

Please Log in to join the conversation.

More
4 years 8 months ago #81559 by KRav
Hi MPIDR,

as far as I know is the datepicker of the datefiled jquery ui. In order to that I would try to set a limit with jquery:
jqueryui.com/demos/datepicker/#min-max

Cheers Kai


research on BLOGS - Professional LimeSurvey support
Consultant - Templates - Training - JQuery magic - Support - Coding - Survey creation and more..

Contact
Professional LimeSurvey support
This email address is being protected from spambots. You need JavaScript enabled to view it.

Please Log in to join the conversation.

More
4 years 8 months ago #81573 by tpartner
More specifically...

1) Set up your survey to use JavaScript .

2) Add the following script to the source of the date question. Replace "QQ" with the date question ID .

The script resets the max and min date options of the datepicker.
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function () {
 
		$(document).ready(function(){
 
		$('#questionQQ .popupdate').datepicker( 'option', 'minDate', new Date(2012, 8 - 1, 13) );
		$('#questionQQ .popupdate').datepicker( 'option', 'maxDate', new Date(2012, 8 - 1, 25) );
	});
 
</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.

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