Welcome Guest Search | Active Topics | Sign In | Register

DatePicker Options
Dhilhaam
Posted: Thursday, July 31, 2008 8:53:39 PM
Rank: Member
Groups: Member

Joined: 6/12/2008
Posts: 10
Hi,

Is "onBlur" works with DatePicker object. At the moment we use "ClientSideOnSelect" to refresh page, but we also need same functionality if the user changes the date directly in text area without picking it from the calendar. Is this possible in this control.

Cheers,
Dhilhaam
eo_support
Posted: Friday, August 1, 2008 6:01:05 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,193
Hi,

The control itself handles onblur to perform certain tasks, so if you handle onblur you will need to call the original onblur so that existing logic continue to work. Also the onblur is attached to the textbox input element, not to the DatePicker. So you will want to view the page source, find out the ID of the textbox, then save the original onblur handler and replace it with yours. In your onblur handler, youw would call the original onblur handler first. Make sure "this" to be the textobx itself when you call the original onblur handler:

Code: JavaScript
var g_datePickerTextBox; 
var g_originalOnBlurHandler;

//Do not call this function directly. Set ClientSideOnLoad to
//this function so that it is called after the DatePicker is loaded 
function setup_blur_handler()
{
    g_datePickerTextBox = document.getElementById("the_id_of_the_textbox");
    g_originalOnBlurHandler = g_datePickerTextBox.onblur;
    g_datePickerTextBox.onblur = your_on_blur_handler; 
}

//This is your onblur handler 
function your_on_blur_handler(e)
{
    //Call the original handler first
    g_originalOnBlurHandler.apply(g_datePickerTextBox, e);

    //Perform other logics that you would like to perferm
    ......
}


The other alternative is to set the DatePicker's AutoPostBackOnSelect to true. That way the DatePicker will postback when you change the date picker value and then tab out.

Thanks
Dhilhaam
Posted: Sunday, August 3, 2008 5:32:09 PM
Rank: Member
Groups: Member

Joined: 6/12/2008
Posts: 10
Thanks for the info. It's all worked.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.