views:

37

answers:

1

I have the following code:

$('#popupDatepickerWeekly').datepick({
   maxDate:'1Y',
   mandatory:true,
   highlightWeek:true,
   onClose: closedDate
});

My closedDate function looks like this:

function closedDate(value, date, inst) { 
 document.signUpForm.repeatUntil.value = value;
}

But when I pick a date using the datepicker, the repeatUntil hidden value is not set.

The hidden form field looks like this:

<input type="hidden" name="repeatUntil" value="">

I don't get an error or anything, but it always comes back as an empty string.

+1  A: 

Try changing your closedDate function to this:

function closedDate(value, date, inst) { 
 $("input[name=repeatUntil]").val(value);
}

Or use an anonymous function like this:

$('#popupDatepickerWeekly').datepick({
   maxDate:'1Y',
   mandatory:true,
   highlightWeek:true,
   onClose: function(value) { 
     $("input[name=repeatUntil]").val(value);
   }
});
Nick Craver