Calling a method when the calendar is closed by choosing the


How do i call a javascript method when the user selects a date in the calendar and the calendar closes?(Not when the user clicks on the X button)



Any help is appreciated.


You can use onClick event handler:


cal.setOnClickHandler(function(date){


/your code here/


})


Alex,



 



Thanks for the prompt answer. Actually what i am looking for is this -



I have a textfield and am loading a calendar onclick. When a user clicks a date in the calendar, i would still like the date show up on the text field and then send the date to the server via AJAX



Using setOnClickHandler, overrides the default behavior of setting the date in the calendar and the calendar closing.



Any help is appreciated.


Hello,


in this case you can use the following method instead of setOnClickHandler:


cal.attachEvent(“onClick”,function(date){


/your code here/

})