Reputation: 119
I'm using ui.datepicker.js
In my edit form I have 2 calendars that have their own function.
Calendar A : is the date that the invoiced is created Calendar B : is the date for next billing Bill_freq is the field where is set the billing frequency (every 1 month, 3 months, 6 months, 12 months)
What I want to do is when date is changed on Calendar A, Calender B will be updated automatically to a date base on Bill_freq field.
Thanks for your help!
Upvotes: 0
Views: 1016
Reputation: 22382
$('#myCalendarA').datepicker({
//other options here
onSelect: function(dateText, inst) {
//pick the value you need
var billFreq = $('#Bill_freq').val();
//do some calculation with dateText (selected date in CalA) and billFreq
var newDate = dateText + billFreq; //beware date calc in JS is hard to master
//sets the date for Calendar B
$('#myCalendarB').datepicker('setDate', newDate) ;
}
});
Upvotes: 1
Reputation: 22041
try something like onchange="$('#Calenderb').val($('#Calendera').val())"
Upvotes: 0