You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Ted Husted (JIRA)" <ji...@apache.org> on 2006/07/11 16:06:16 UTC
[jira] Commented: (STR-899) adding focus to the tag
with two forms of the same name generates a javascript error
[ http://issues.apache.org/struts/browse/STR-899?page=comments#action_37709 ]
Ted Husted commented on STR-899:
--------------------------------
One alternative is described here:
* http://www.codeproject.com/jscript/FocusFirstInput.asp
> adding focus to the <html:form> tag with two forms of the same name generates a javascript error
> ------------------------------------------------------------------------------------------------
>
> Key: STR-899
> URL: http://issues.apache.org/struts/browse/STR-899
> Project: Struts 1
> Type: Bug
> Components: Taglibs
> Versions: 1.1 Beta 2
> Environment: Operating System: other
> Platform: Other
> Reporter: Matt Raible
> Assignee: Struts Developers
>
> If you have a JSP with 2 forms of the same name (action) - the javascript
> rendered results in a javascript error.
> To solve - change this:
> <script language="JavaScript" type="text/javascript">
> <!--
> if (document.forms["uploadFiles"].elements["uploadedFile"].type != "hidden")
> document.forms["uploadFiles"].elements["uploadedFile"].focus()
> // -->
> </script>
> To something like:
> <script language="JavaScript" type="text/javascript">
> <!--
> if (document.forms[1].elements["uploadedFile"].type != "hidden")
> document.forms[1].elements["uploadedFile"].focus()
> // -->
> </script>
> So you'd have to know the number of forms on the page. Also, the
> language="Javascript" is not needed (it's invalid for XHTML), just the type.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira