I've got two date pickers in one form. They have different id's so this shouldn't be related to similar errors such as this one. http://stackoverflow.com/questions/1836697/jquery-apply-selector-to-every-field-in-a-dynamic-form
The error I'm getting in firebug is 'uncaught exception: Missing instance data for this datepicker'
Which is triggered when I select a day from the '#copyTo' datepicker which is the second datepicker on the form. The first datepicker works perfectly.
The form I have is
<form name="copy" action="copyEvents.php" method="post"> <input type="hidden" id="copyFromHid" name="copyFromHid"/> <input type="hidden" id="copyToHid" name="copyToHid"/> Copy From <input id="copyFrom" name="copyFrom"/> Copy To <input type="text" id="copyTo" name="copyTo"/> <input type="hidden" name="gid" id="gid"/> <input type="submit" value="copy"/> </form>
The jquery is
jQuery('input#copyFrom','div#copyFromHistory form').datepicker({
altField: 'input#copyFromHid',
altFormat: 'yy-mm-d',
dateFormat: 'd MM yy',
firstDay: 1,
beforeShowDay: function(date) {
return (date.getDay() == 1) ? [true, ""] : [false, ""]; }
});
jQuery('input#copyTo','div#copyFromHistory form').datepicker({
altField: 'input#copyToHid',
altFormat: 'yy-mm-d',
dateFormat: 'd MM yy',
firstDay: 1,
beforeShowDay: function(date) {
return (date.getDay() == 1) ? [true, ""] : [false, ""]; }
});
Any suggestions as to why the first field would work, but not the second?