BTW, I have found that the Javascript generated here does not seem to
work well with Netscape 4.7 (Windows). It focusses on the field at
first, but jumps to the browser's "Address" field when you press tab.
For this browser/platform, it does work correctly when put into the
<body> tag -- onload="document.logonForm.username.focus();"
[EMAIL PROTECTED] wrote:
>
> craigmcc 01/03/06 14:09:53
>
> Modified: src/doc release-notes-1.0-b2.xml struts-html.xml
> src/share/org/apache/struts/taglib/html FormTag.java
> Log:
> Correct the JavaScript generated to implement the "focus" attribute of the
> <html:form> tag so that it works even when you use nested or indexed property
> expressions for the field you want initial focus on.
>
> Submitted by: Hal Deadman <[EMAIL PROTECTED]>
> PR: Bugzilla #714
>
> Revision Changes Path
> 1.2 +6 -0 jakarta-struts/src/doc/release-notes-1.0-b2.xml
>
> Index: release-notes-1.0-b2.xml
> ===================================================================
> RCS file: /home/cvs/jakarta-struts/src/doc/release-notes-1.0-b2.xml,v
> retrieving revision 1.1
> retrieving revision 1.2
> diff -u -r1.1 -r1.2
> --- release-notes-1.0-b2.xml 2001/03/06 20:40:35 1.1
> +++ release-notes-1.0-b2.xml 2001/03/06 22:09:49 1.2
> @@ -36,6 +36,8 @@
> <li>The <code><html:link></code> tag now accepts an optional
> <code>anchor</code> attribute, to allow the inclusion of a
> (possibly calculated) anchor ("#xxx") in the generated hyperlink.</li>
> + <li>The <code><html:base></code> tag now accepts an optional
> + <code>target</code> attribute.</li>
> </ul>
>
> <p>The following new features have been added to the
> @@ -70,6 +72,10 @@
> hyperlink value.</li>
> <li>The <code><html:link></code> tag now correctly places any
> specified anchor ("#xxx") in the generated hyperlink.</li>
> + <li>The JavaScript code generated to implement the <code>focus</code>
> + attribute of the <code><html:form></code> tag now works even
> + when you use nested or indexed property expressions. Previously,
> + this would generate an invalid JavaScript reference to the field.</li>
> </ul>
>
> <p>The following changes and bug fixes to the Struts Documentation
>
>
>
> 1.19 +10 -0 jakarta-struts/src/doc/struts-html.xml
>
> Index: struts-html.xml
> ===================================================================
> RCS file: /home/cvs/jakarta-struts/src/doc/struts-html.xml,v
> retrieving revision 1.18
> retrieving revision 1.19
> diff -u -r1.18 -r1.19
> --- struts-html.xml 2001/03/06 17:04:18 1.18
> +++ struts-html.xml 2001/03/06 22:09:50 1.19
> @@ -41,6 +41,16 @@
> took place (which is where the browser would normally resolve
> relative references against).</p>
> </info>
> +
> + <attribute>
> + <name>target</name>
> + <required>false</required>
> + <rtexprvalue>true</rtexprvalue>
> + <info>
> + <p>The window target for this base reference.</p>
> + </info>
> + </attribute>
> +
> </tag>
>
> <tag>
>
>
>
> 1.7 +8 -7
>jakarta-struts/src/share/org/apache/struts/taglib/html/FormTag.java
>
> Index: FormTag.java
> ===================================================================
> RCS file:
>/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/FormTag.java,v
> retrieving revision 1.6
> retrieving revision 1.7
> diff -u -r1.6 -r1.7
> --- FormTag.java 2001/03/06 16:58:24 1.6
> +++ FormTag.java 2001/03/06 22:09:52 1.7
> @@ -1,7 +1,7 @@
> /*
> - * $Header:
>/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/FormTag.java,v 1.6
>2001/03/06 16:58:24 craigmcc Exp $
> - * $Revision: 1.6 $
> - * $Date: 2001/03/06 16:58:24 $
> + * $Header:
>/home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/FormTag.java,v 1.7
>2001/03/06 22:09:52 craigmcc Exp $
> + * $Revision: 1.7 $
> + * $Date: 2001/03/06 22:09:52 $
> *
> * ====================================================================
> *
> @@ -85,7 +85,7 @@
> * properties correspond to the various fields of the form.
> *
> * @author Craig R. McClanahan
> - * @version $Revision: 1.6 $ $Date: 2001/03/06 16:58:24 $
> + * @version $Revision: 1.7 $ $Date: 2001/03/06 22:09:52 $
> */
>
> public class FormTag extends TagSupport {
> @@ -556,10 +556,11 @@
> results.append("<script language=\"JavaScript\"");
> results.append(" type=\"text/javascript\">\r\n");
> results.append(" <!--\r\n");
> - results.append(" document.");
> + results.append(" document.forms[\"");
> results.append(name);
> - results.append(".");
> - results.append(focus);
> + results.append("\"].elements[\"");
> + results.append(focus);
> + results.append("\"]");
> results.append(".focus()\r\n");
> results.append(" // -->\r\n");
> results.append("</script>\r\n");
>
>
>
-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 737-3463.
-- http://www.husted.com/about/struts/