Hi
I'm using two webdatepickers in a webdialoguewindow (from - to)
The user should be able to choose a timespan up to one year maximum, so I want to set maxdate of [to] to [from].getValue()+365 if [from] was changed
and mindate of [from] to [to].getValue()-365 if [to] was changed.
Can this be done in javascript?
Hello Tobias,
Thank you for using our community.
You can achieve that functionality by using the ValueChanged client events. I have created a simple sample for you to demonstrate you how to access the controls and change dynamically the max and min value. Please take a look at it and let me know if you have further questions.
that helped a lot thanx!
finally I ended up with
function fromValueChanged(e, u) {
var minValue = u.get_value();
if (minValue != null) {
var maxValue = new Date(minValue.valueOf());
maxValue.setFullYear(minValue.getFullYear() + 1);
wdpSCFValidTo.set_minValue(minValue);
wdpSCFValidTo.set_maxValue(maxValue);
} else {
wdpSCFValidTo.set_minValue(null);
wdpSCFValidTo.set_maxValue(null);
}
function toValueChanged(e, u) {
var maxValue = u.get_value();
if (maxValue != null) {
var minValue = new Date(maxValue.valueOf());
minValue.setFullYear(newValue.getFullYear() - 1);
wdpSCFValidFrom.set_maxValue(maxValue);
wdpSCFValidFrom.set_minValue(minValue);
wdpSCFValidFrom.set_maxValue(null);
wdpSCFValidFrom.set_minValue(null);