You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2005/07/20 13:06:21 UTC
DO NOT REPLY [Bug 22700] -
[taglib] Add check for nonexistent form field in focus javascript
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=22700>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=22700
------- Additional Comments From frank.premereur@gmail.com 2005-07-20 13:06 -------
(In reply to comment #0)
> After processing the <html:form> tag, some javascript is displayed to force the
> focus to one of the components in the form. However, it is possible that the
> form field may not exist or may become a label if a user doesn't have modify
> access to the field. In this case a javacript error of 'Object Not Found' is
> displayed in a dialog box when the page is loaded.
>
> The existing javascript focuses into the form field provided the field isn't
hidden.
>
> However, an additional check should be performed to ensure that the form field
> exists. Only then (in addition to the field not being hidden) should the
> javascript move the focus to the field.
>
>
> Resolution
> ----------
> In the FormTag's doEndTag() method a call is made to renderFocusJavascript().
>
> The renderFocusJavascript() method does the following:
> results.append(" if (focusControl.type != \"hidden\") {");
>
> Change this to:
> // Was previously setting the focus to the first text component
> // if it wasn't a hidden field.
> // Add an extra check to verify that the field exists.
> results.append(" if (! focusControl.type === undefined && ");
> results.append(" focusControl.type != \"hidden\") {");
The javascript above isn't quite correct. Rather then checking for undefined you
should test against null. So you get:
results.append(" if (focusControl.type != null && ");
results.append(" focusControl.type != \"hidden\") {");
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org