I have a WebDatePicker on my page. In the client side, I need to set the value. I have the following code in place which I call by sending in the ID of the date picker and the value I want it set to:
function setOpenerDate(id, value){ var dt= new Date(value); var datepicker= window.opener.$find(id); alert('value=' + datepicker.get_value()); datepicker.set_value(dt); alert('value=' + datepicker.get_value());}
The value I'm sending in for testing is "5/9/2013". I've verified that the grabbing of the WebDatePicker is successful. As you can see, I have two alerts. The first one comes back "value=null" (which is expected, since I never set the value while building the page). But, the second one always comes back "value=Thu Jun 05 2014 00:00:00 GMT-0500 (Central Standard Time)" (it happens to be the 5th right now, so I'm assuming it is just getting set as the current date). I also previously had an alert to show me the value of "dt", which comes back as "value=Thu May 09 2013 00:00:00 GMT-0500 (Central Standard Time)", so I know the date is being set properly. Can you see what could be going wrong here? Thanks!
We are on version 13.2.20132.2028 and using .NET Framework 4.5.
Hello Dave,
Thank you for posting in our forum.
I’ve tested this on my side and the method set_value seems to work as expected on my side.
Could you let me know on which event you’re calling that method?
I’ve attached a sample for your reference where on a button’s click event the value gets set to "5/9/2013" and it seems to work as expected.
Please test it on your side and let me know if you’re getting a different result.
If the value is not getting set as expected please let me know on which browser you’re getting the incorrect behavior.
If the sample is not an accurate demonstration of what you’re doing, please feel free to modify it and send it back.
I’m looking forward to your reply.
Best Regards,
Maya Kirova
Developer Support Engineer II
Infragistics, Inc.
http://es.infragistics.com/support
Thank you for such a prompt reply. After trying out your example, and modifying it a little to use a popup to set the date on the original form, it was working fine. So I went back to the drawing board. Then I realized...as I was building the form, I was setting the minDate and maxDate on the WebDatePicker, and the data being used to build the page was setting both to the current day. So after fixing my data that was used to set those dates, it now works just fine. Sorry for wasting your time! Funny how a good night's rest can help you open your mind to different options.