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.
Example:
<table>
<html:form action="/logon" focus="username">
<html:text property="username" size="15" maxlength="15"
onblur="document.logonForm.password.focus();"/>
<tr>
<td align="right"><font size="-1"><u>U</u>sername</font></td>
<td>
<html:text property="username"
onblur="document.registerForm.password.focus();"/>
</td>
</tr>
<tr>
<td align="right"><font size="-1"><u>P</u>assword</font>
</td>
<td>
<html:password property="password" size="15" maxlength="15" tabindex="2"
accesskey="p"/>
</td>
</tr>
<td align="right" colspan="2"><html:submit property="submit" value="SIGN
IN" />
</td>
</table>
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.
-- http://www.husted.com/about/struts/