struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Musachy Barroso (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (WW-2704) Form focusElement attribute not resulting in correct Javascript
Date Tue, 16 Dec 2008 04:35:36 GMT

     [ https://issues.apache.org/struts/browse/WW-2704?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Musachy Barroso resolved WW-2704.
---------------------------------

    Resolution: Not A Problem

focusElement expects the id if an element, not the name:

"Id of element that will receive the focus when page loads"

add an id to the element, and pass it to focusElement and it will work.



> Form focusElement attribute not resulting in correct Javascript
> ---------------------------------------------------------------
>
>                 Key: WW-2704
>                 URL: https://issues.apache.org/struts/browse/WW-2704
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.1.2
>         Environment: struts2-core-2.1.2 xwork-2.1.1 struts.ui.theme=xhtml
>            Reporter: Owen Berry
>            Priority: Minor
>             Fix For: 2.1.3
>
>
> The Javascript generated for the focusElement attribute on a form is incorrect as it
does not include the form id as a prefix for the id of the element to focus on. See example
below.
> Sample form:
>   <s:form id="dologin" method="post" namespace="/" action="dologin" focusElement="username">
>   <s:textfield label="User" name="username" />
>   <s:password label="Password" name="password" />
>   <s:submit value="Login" />
>   </s:form>
> Generated form tag:
>   <input type="text" name="username" value="" id="dologin_username"/>
> Generated Javascript:
>   StrutsUtils.addOnLoad(function() {
>       var element = document.getElementById("username");
>       if(element) {
>           element.focus();
>       }
>   });
> What Javascript should look like:
>   StrutsUtils.addOnLoad(function() {
>     var element = document.getElementById("dologin_username");
>     if(element) {
>         element.focus();
>     }
>   });

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message