Hi,
I have a webDateChooser in my aspx page and 2 text boxes below it. When I select a date through the DateChooser drop down, I want to check if the selected date in less than Sep-30-2015. If this condition is met, then the Text box A should be enabled else if the Date is greater than Oct-01-2015 then the Text Box B should be enabled.
I am trying to write the below JavaScript on the AfterCloseUp event (please correct me If I am wrong here).
Any urgent help is much appreciated. Thanks in advance !
function CalendarDateOfServiceNew_AfterCloseUp(oDateChooser, dropDownPanel, oEvent) {
var date = oDateChooser.getValue();
alert(date);
if (date <= '09/30/2015') {
alert('Text Box A Enableed');
document.getElementById('<%=TextBoxA%>').enabled = true;
}
else {
alert('Text Box B Enableed');
document.getElementById('<%=TextBoxB%>').enabled = true;
Hello Gaurav,
Thank you for using our community.
What I can suggest you to do is use the valueChanged client event and add your custom code there. You can take the selected date like this:
var selectedDate = eventArgs.get_value().format("MM/dd/yyyy");
I have created a simple sample for you. Please take a look at it and let me know how it works for you.
Hi Marina,
Firstly, I tried your example but it does not seem to work. When I click on the date dropdown and select the date, nothing happens. I tried to put a alert there to see if I am getting the date but I am not.
I am using a WebDateChoose in my code and your example is with a WebDatePicker. Will that make any difference in the event we are using?
Secondly, In my example which I thought worked, the else part in the below code is not working. While I am getting the proper date which I select from the dropdown, the TextBox is not getting highlighted. Please help :(
var dt = (date.getMonth() + 1) + '/' + date.getDate() + '/' + date.getFullYear();
alert((date.getMonth() + 1) + '/' + date.getDate() + '/' + date.getFullYear());
if (dt <= '9/30/2015') {
document.getElementById('<%=CodeTextBoxA.ClientID%>').disabled = false;
document.getElementById('<%=CodeTextBoxB.ClientID%>').disabled = true;
else if (dt >= '10/1/2015') {
document.getElementById('<%=CodeTextBoxA.ClientID%>').disabled = true;
document.getElementById('<%=CodeTextBoxB.ClientID%>').disabled = false;
The sample I have created for you is using the latest version of the WebDatePicker (15.1). The WebDateChooser was last supported in 11.1 version of our controls. Those two controls are built upon a different architecture and support different options and methods.
Please note that while Developer Support for NetAdvantage for 11.1 is available until May 2014, Service Release support for that product version and the retired classic toolset has expired - development issues are no longer being fixed for that version. Similarly support is no longer being added for newer platforms. More information may be found on our product lifecycle page at:
http://es.infragistics.com/help/product-lifecycle/
What is more, all possible solutions for similar unsupported issues now, if there are such could be found in our community /forum.
I have tested your custom code in my sample and it is working as expected. If I understood you correctly the issue you are facing is not directly related to our control, but nevertheless I highly recommend you to update your project to one of the latest versions of our products.
Hello,
I am still following your case. If you have any concerns or questions, please feel free to contact me, I will be glad to help you.
Thank you for choosing Infragistics components!
I have solved this by making changes to my JavaScript code. Thanks a lot for getting back on this. I really appreciate your efforts.
You can close this case for now. Have a good day !
Regards
Gauravv