Add a date/time question in a Array (Texts) question

More
2 years 8 months ago #118339 by stevelegare
stevelegare created the topic: Add a date/time question in a Array (Texts) question
Hi all,
I need to insert a calendar (date/time question) in the last answer of a Array(text) question.
Can I do it and do you have an example?
Thanks
Attachments:

Please Log in to join the conversation.

More
2 years 8 months ago #118367 by tpartner
tpartner replied the topic: Add a date/time question in a Array (Texts) question
Rather than using the LimeSurvey Date question, you could apply your own a jQuery UI Datpickers to those inputs.

Something like this in the source of the question:

<script type="text/javascript" charset="utf-8">	
	$(document).ready(function() {
 
		// Identify this question
		var thisQuestion = $('#question{QID}');
 
		// Apply some classes
		$('tr.subquestion-list td.answer-item:last-child', thisQuestion).addClass('last-column-item');
 
		// Insert the datepickers
		$('.last-column-item input[type="text"]', thisQuestion).datepicker({
			dateFormat: "dd/mm/yy"
		});	
 
		// Fix up the datepicker position
		$('.last-column-item input[type="text"]', thisQuestion).on('click focus', function() {
			$("#ui-datepicker-div").position({
				my: "left top",
				at: "left-3 top-3",
				of: $(this)
			});
		});	
	});
</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
2 years 8 months ago #118378 by stevelegare
stevelegare replied the topic: Add a date/time question in a Array (Texts) question
Wow!
Thanks a lot for this beautiful snippet of code :-)

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!