Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onblur and radio buttons

Status
Not open for further replies.

cawthor

Programmer
May 31, 2001
89
US
I have a text box that I immediately validate using an OnBlur function. However, if the user clicks on a radio button after they have entered their text (which triggers the onBlur event), the radio button doesn't get selected. You have to then click the radio button a second time to select it.

Maybe easier by example:

<input type="text" onfocusout ="alert('HELLO')">
<input type="radio" name="test">
<input type="radio" name="test">

if you view the above html, type something in the text box and then click a radio button. The alert is displayed but the radio button is not selected. You need to click it again to select it.

Any ideas??
 
what about a slightly different concept:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">[/URL]

<html>
<head>
<title>Untitled</title>
<script type="text/javascript"><!--
function doCheck(v) {
    if ( v.value != "cory" ) {
        alert("invalid!");
        v.focus();
        return false;
    }
    return true;
}
//--></script>
</head>

<body>

<form name="f">
<input type="text" onblur="return doCheck(this);">
<input type="radio" name="test">
<input type="radio" name="test">
</form>

</body>
</html>

*cLFlaVA
----------------------------
[tt]I already made like infinity of those at scout camp...[/tt]
beware of active imagination: [URL unfurl="true"]http://www.coryarthus.com/[/url]

BillyRayPreachersSonIsTheLeetestHax0rDude
[banghead]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top