I've experimented and can make it work.
I now want to use the date of a datepicker to limit the minDate of a second one.
How can this be achieved?
I have a short text question defined as datepicker date1. I tried something like this in the javascript code of date2:
Code:
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
// Identify this question
var thisQuestion = $('#question{QID}');
// Make dates
var mindate = new Date();
var maxdate = new Date();
var str= {date1};
// Insert the datepicker
$('input[type="text"]', thisQuestion).datepicker({
dateFormat: "dd/mm/yy",
minDate: new Date(Date.parse(str.substring(0,9))),
maxDate: new Date();
});
// Fix up the datepicker position
$('input[type="text"]', thisQuestion).on('click focus', function() {
$("#ui-datepicker-div").position({
my: "left top",
at: "left-3 top-3",
of: $(this)
});
});
});
</script>
This does not work at all, it fails at line var str= {date1};
I also tried to implement the suggestion at
www.limesurvey.org/manual/Workarounds:_M..._other_Datequestions
but at no success.
Any help will be appreciated