You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Owen Berry (JIRA)" <ji...@apache.org> on 2008/07/01 18:24:06 UTC
[jira] Created: (WW-2704) Form focusElement attribute not resulting
in correct Javascript
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
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.
[jira] Updated: (WW-2704) Form focusElement attribute not resulting
in correct Javascript
Posted by "James Holmes (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-2704?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
James Holmes updated WW-2704:
-----------------------------
Fix Version/s: 2.1.3
> 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.
[jira] Resolved: (WW-2704) Form focusElement attribute not
resulting in correct Javascript
Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
[ 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.