The LimeSurvey Fund-Raiser 2012 is complete. Thank you for donating a total of 25,000 USD!     List of donors »

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

TOPIC: limit period of time in date field

limit period of time in date field 11 months 2 weeks ago #81529

  • MPIDR
  • MPIDR's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 17
  • Karma: 0
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
The administrator has disabled public write access.

Aw: limit period of time in date field 11 months 1 week ago #81559

  • ResearchOnBlogs
  • ResearchOnBlogs's Avatar
  • OFFLINE
  • Gold Lime
  • Posts: 171
  • Thank you received: 16
  • Karma: 8
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 e-mail address is being protected from spambots. You need JavaScript enabled to view it
The administrator has disabled public write access.

Re: limit period of time in date field 11 months 1 week ago #81573

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 2858
  • Thank you received: 424
  • Karma: 244
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

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.
  • Page:
  • 1
Moderators: DenisChenu, ITEd
Time to create page: 0.181 seconds
Donation Image