struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Husted <>
Subject Re: focus and Navigator 4.x
Date Fri, 30 Mar 2001 03:18:11 GMT
Coincidentally, I was getting ready to post this to the FAQ: 


Under Netscape 4.7 for Windows, the html:form focus feature doesn't work
properly. Is there a work around?

The problem is that the focus feature works all right at first, but when
you press tab, it proceeds to the address bar, rather than the next
field. After you tab around once, it starts working as expected. One
work around is to use the "onblur" event on the initial field to select
the second. After that, you're in like Flint. 


<html:form action="/logon" focus="username">
<html:text property="username" size="15" maxlength="15"
<td align="right"><font size="-1"><u>U</u>sername</font></td>
<html:text property="username"
<td align="right"><font size="-1"><u>P</u>assword</font>
<html:password property="password" size="15" maxlength="15" tabindex="2"
<td align="right" colspan="2"><html:submit property="submit" value="SIGN
IN" />

Note that this workaround will break if the name of the form changes. (A
simple "this.{field}.focus()" doesn't work.) The big fix is to put the
Javascript in the body tag, but that implies adding a <html:body> tag to
the Struts library. The next alternative might be to extend the
html:text tag so that it could produce the "onblur" fix automatically,
inserting the proper form name from the struts-config file.

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 737-3463.

View raw message