The MindFusion Forums
MindFusion.UI controls >> ASP.NET >> datepicker, set max and min value
https://mindfusion.eu/Forum/YaBB.pl?num=1417721590

Message started by Xylon on Dec 4th, 2014 at 7:33pm

Title: datepicker, set max and min value
Post by Xylon on Dec 4th, 2014 at 7:33pm
Hi there,

I tried to set the datepicker min/max value based on my radio input client function.

It like when I select a radio input, the javascript is about to set the datepicker min/max date limit.

say I select radio input 1, then
here is the code :


Code (javascript):

var today = new Date();

$find("DatePicker1").set_maxDate(today);
                    $find("DatePicker2").set_maxDate(today);



I am sure the function is invoked since I run it step by step via breakpoint, but when I open the datepicker calendar to select date, I still can select the date which later than today.

Thank you

Title: Re: datepicker, set max and min value
Post by Lyubo on Dec 7th, 2014 at 6:50am
Hi,

If you set a value which is outside of the range defined by MinDate and MaxDate, the new value is accepted, but the ValidationState of the control is set to Invalid.

To respond to state changes, you should handle the stateChanged and/or valueInvalid client-side event. From there you can either indicate to the user that the input date is out of bounds, or you can change the control's value to a date that falls within the given range.

Regards,
Lyubo

The MindFusion Forums » Powered by YaBB 2.6.11!
YaBB Forum Software © 2000-2024. All Rights Reserved.