You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Radek Mensik (JIRA)" <ji...@apache.org> on 2007/04/11 22:22:51 UTC
[jira] Commented: (STR-899) adding focus to the tag
with two forms of the same name generates a javascript error
[ https://issues.apache.org/struts/browse/STR-899?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_40778 ]
Radek Mensik commented on STR-899:
----------------------------------
My solution, how to fix SAME NAMES IN ALL FORMS connected with same ACTION is : if the name of form is wrong, just try all forms, if they containt the element you wanna update.
Example : Replace this
function showCalendar(year, month, day, pattern, formName, formProperty, event, startYear, endYear) {
if (document.forms[formName].elements[formProperty].disabled) {
return;
}
and fill the while cycle to find correct form
function showCalendar(year, month, day, pattern, formName, formProperty, event, startYear, endYear) {
i=1
while(document.forms[formName].elements[formProperty]==null&&i<20){
formName=i;r
i++;
}
if (document.forms[formName].elements[formProperty].disabled) {
return;
}
> adding focus to the <html:form> tag with two forms of the same name generates a javascript error
> ------------------------------------------------------------------------------------------------
>
> Key: STR-899
> URL: https://issues.apache.org/struts/browse/STR-899
> Project: Struts 1
> Issue Type: Bug
> Components: Taglibs
> Affects Versions: 1.1 Beta 2
> Environment: Operating System: other
> Platform: Other
> Reporter: Matt Raible
> Assigned To: 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.
-
You can reply to this email to add a comment to the issue online.