Validation on Text onblur

Hello,

I would like to excecute some validation code when the user tabs out of the Textbox .i have written the code inside the onblur() event of the Textbox. But when the user clicks a button with the focus remaining inside the textbox , i would like to avoid execution of the validation code.

how can i achieve this ?
[337 byte] By [rodin] at [2007-11-20 11:33:53]
# 1 Re: Validation on Text onblur
<script type="text/javascript">
var textFocus = false;
function checkfocus(){
return (textfocus) ? false : true;
}
</script>

<form onsubmit="return checkfocus()">
<textarea onfocus="textFocus=true" onblur="textFocus=false"></textarea>
...
PeejAvery at 2007-11-8 0:43:23 >
# 2 Re: Validation on Text onblur
<script type="text/javascript">
var textFocus = false;
function checkfocus(){
return (textfocus) ? false : true;
}
</script>

<form onsubmit="return checkfocus()">
<textarea onfocus="textFocus=true" onblur="textFocus=false"></textarea>
...
thanx for ur response.

but how do i prevent the onblur (this is where i have my validation code) of the Textbox from firing when user cliks the button. ?

I would like the textbox validation code to execute everytime the textbox loses focus but when user clicks the button the code must not execute.
rodin at 2007-11-8 0:44:23 >
# 3 Re: Validation on Text onblur
but how do i prevent the onblur (this is where i have my validation code) of the Textbox from firing when user cliks the button. ?
Sorry. I misunderstoof the first time.

The onblur event will fire before any other onclick event, so making it not work by clicking a button will do nothing. Can you post the code you have, and clearly explain why you want to do this? Perhaps we can make a different work-around.
PeejAvery at 2007-11-8 0:45:31 >