You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Musachy Barroso (JIRA)" <ji...@apache.org> on 2009/04/18 20:50:06 UTC

[jira] Resolved: (WW-2951) id and name attributes should have the same value for the form tag

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

Musachy Barroso resolved WW-2951.
---------------------------------

    Resolution: Fixed

fixed in trunk. the "name" will default to the same value as id. thanks for reporting

> id and name attributes should have the same value for the form tag
> ------------------------------------------------------------------
>
>                 Key: WW-2951
>                 URL: https://issues.apache.org/struts/browse/WW-2951
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Plugin - Tags
>    Affects Versions: 2.0.14
>            Reporter: Jean-Michel Morel
>            Priority: Minor
>             Fix For: 2.1.7
>
>
> if they are not provided by the s:form tag, the form component use the action name to fill 'id' and 'name' attributes.
> In the case where only the id is given, id and name attributes have different values which is not recommended, especially in xhtml form: if the both are present, they should have the same value.
> the Form Component is responsible for this behaviour, I've seen in evaluateExtraParamsServletRequest(...) method the following lines :
>            // if the name isn't specified, use the action name
>             if (name == null) {
>                 addParameter("name", action);
>             }
>             // if the id isn't specified, use the action name
>             if (id == null && action!=null) {
>                 addParameter("id", escape(action));
>             }
> which should be :
>             // if the name isn't specified, use the id name or the action name
>             if (name == null) {
>                 if (id != null) {
>                     addParameter("name", id);
>                  }
>                 else if (action!=null) {
>                     addParameter("name", action);
>                  }
>             }
>             // if the id isn't specified, use the action name
>             if (id == null && action!=null) {
>                 addParameter("id", escape(action));
>             }

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