Welcome Guest Search | Active Topics | Sign In | Register

EO web controls - Focus Options
thierry
Posted: Wednesday, May 7, 2008 6:19:51 AM
Rank: Newbie
Groups: Member

Joined: 4/25/2008
Posts: 3
Hi,

How to change the background color or the border color of the datepicker textbox when it get the focus (how to fire onfocus event ?) ?

Thanks
eo_support
Posted: Wednesday, May 7, 2008 6:33:52 AM
Rank: Administration
Groups: Administration

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

You can use the following code to do so:

Code: JavaScript
function textbox_focus_handler(e)
{
    //Call the original handler
    this.oldOnFocus(e);
	
    //Change background color
    this.style.backgroundColor = "green";
}

function textbox_blur_handler(e)
{
    //Call the original handler
    this.oldOnBlur(e);
	
    //Change background color
    this.style.background = "white";
}
		
function init()
{
    var textbox = document.getElementById("_eo_DatePicker1_picker");
	
    //Save old onfocus and onblur handler
    textbox.oldOnFocus = textbox.onfocus;
    textbox.oldOnBlur = textbox.onblur;
	
    //Hook up our new handlers
    textbox.onfocus = textbox_focus_handler;
    textbox.onblur = textbox_blur_handler;
}


Code: HTML/ASPX
<eo:DatePicker ClientSideOnLoad="init" ....>
</eo:DatePicker>


Note you will need to replace "DatePicker1" with the actual ID of your DatePicker control for the document.getElementById call. If you are not sure what it is, you can view the page's HTML source and find out.

Thanks
thierry
Posted: Wednesday, May 7, 2008 7:04:47 AM
Rank: Newbie
Groups: Member

Joined: 4/25/2008
Posts: 3
Thanks a lot,
It works fine !

mohan
Posted: Thursday, October 9, 2008 5:51:25 PM
Rank: Newbie
Groups: Member

Joined: 9/3/2008
Posts: 5
the following code is not working correctly, its calling init()
but its not calling textbox_blur_handler(e)
when the browser is refresh some is working and some time is not working.

i am using client side monitor code also for the same page

is there any other alternative way, at server side it self do this things


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.