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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stop in the name of Focus, before you break my heart.....

Status
Not open for further replies.

Meleagant

Programmer
Aug 31, 2001
166
US
Hoped y'all liked the musical intro (had that song stuck in my head all day.)

I'm validating a whole bunch of fields on an ASP page. What I need to do is to keep the next field from receiving focus, because it will blurr when I set focus back to the field with an error, thus creating an infinite loop of errors. (Ironically much like my life.) Everything works fine if I use onChange, but then again I can get away with passing bad data to the DB, and that's just wrong.

Think it O-O-over...dooo...dooo...dooo

Thanks,

-- Joe --
 
Here is the code i use in my html files
I verify this in the onsubmit event but it works even in on blur method

Code:
<HTML>
<HEAD>
<META NAME=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual Studio 6.0&quot;>
<TITLE></TITLE>
<script language=&quot;javascript&quot;>
function check(elem)
{
	if(elem.value==&quot;&quot;)
	{
		alert(&quot;U must put an value in the field!&quot;);
		elem.focus();
	};
};
</script>
</HEAD>
<BODY>
Name:<input type=&quot;text&quot; onblur=&quot;check(this);&quot;><br>
Age:<input type=&quot;text&quot; onblur=&quot;check(this);&quot;><br>
Location:<input type=&quot;text&quot; onblur=&quot;check(this);&quot;><br>
</BODY>
</HTML>
________
George, M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top