You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Yinghao LI (JIRA)" <ji...@apache.org> on 2007/09/05 16:31:35 UTC

[jira] Created: (WW-2156) double doubleselect without ids and name cause selection error

double doubleselect without ids and name cause selection error
--------------------------------------------------------------

                 Key: WW-2156
                 URL: https://issues.apache.org/struts/browse/WW-2156
             Project: Struts 2
          Issue Type: Bug
          Components: Views
    Affects Versions: 2.0.9
            Reporter: Yinghao LI


When there are two doubleselect without id attributes, the selection of the first's first select while change the options of the second's second select.

The problem is :
the name and the id of doubleselect aren't required attributes. When they are both absent, the value of name and id is the form_name concat with "_". When we use two or more doubleselect,  struts will create same variables and function in javascript with the doubleselect.ftl in the simple template.

Personnally, i think the id of doubleselect should use the doubleName's value when there is neither id attribute nor name attribute.


<script type="text/javascript">
<#assign itemCount = startCount/>
    var ${parameters.id}Group = new Array(${parameters.listSize} + ${startCount});
    for (i = 0; i < (${parameters.listSize} + ${startCount}); i++)
    ${parameters.id}Group[i] = new Array();

<@s.iterator value="parameters.list">
    <#if parameters.listKey?exists>
        <#assign itemKey = stack.findValue(parameters.listKey)/>
    <#else>
        <#assign itemKey = stack.findValue('top')/>
    </#if>
    <#if parameters.listValue?exists>
        <#assign itemValue = stack.findString(parameters.listValue)/>
    <#else>
        <#assign itemValue = stack.findString('top')/>
    </#if>
    <#assign doubleItemCount = 0/>
    <@s.iterator value="${parameters.doubleList}">
        <#if parameters.doubleListKey?exists>
            <#assign doubleItemKey = stack.findValue(parameters.doubleListKey)/>
        <#else>
            <#assign doubleItemKey = stack.findValue('top')/>
        </#if>
        <#assign doubleItemKeyStr = doubleItemKey.toString() />
        <#if parameters.doubleListValue?exists>
            <#assign doubleItemValue = stack.findString(parameters.doubleListValue)/>
        <#else>
            <#assign doubleItemValue = stack.findString('top')/>
        </#if>
    ${parameters.id}Group[${itemCount}][${doubleItemCount}] = new Option("${doubleItemValue}", "${doubleItemKeyStr}");

        <#assign doubleItemCount = doubleItemCount + 1/>
    </...@s.iterator>
    <#assign itemCount = itemCount + 1/>
</...@s.iterator>

    var ${parameters.id}Temp = document.${parameters.formName}.${parameters.doubleId};
<#assign itemCount = startCount/>
<#assign redirectTo = 0/>
<@s.iterator value="parameters.list">
    <#if parameters.listKey?exists>
        <#assign itemKey = stack.findValue(parameters.listKey)/>
    <#else>
        <#assign itemKey = stack.findValue('top')/>
    </#if>
    <#if tag.contains(parameters.nameValue, itemKey)>
        <#assign redirectTo = itemCount/>
    </#if>
    <#assign itemCount = itemCount + 1/>
</...@s.iterator>
    ${parameters.id}Redirect(${redirectTo});
    function ${parameters.id}Redirect(x) {
    	var selected = false;
        for (m = ${parameters.id}Temp.options.length - 1; m >= 0; m--) {
            ${parameters.id}Temp.options[m] = null;
        }

        for (i = 0; i < ${parameters.id}Group[x].length; i++) {
            ${parameters.id}Temp.options[i] = new Option(${parameters.id}Group[x][i].text, ${parameters.id}Group[x][i].value);
            <#if parameters.doubleNameValue?exists>
            	if (${parameters.id}Temp.options[i].value == '${parameters.doubleNameValue}') {
            		${parameters.id}Temp.options[i].selected = true;
            		selected = true;
            	}
            </#if>
        }

        if ((${parameters.id}Temp.options.length > 0) && (! selected)) {
           	${parameters.id}Temp.options[0].selected = true;
        }
    }
</script>


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


[jira] Issue Comment Edited: (WW-2156) double doubleselect without ids and name cause selection error

Posted by "Yinghao LI (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44618#action_44618 ] 

yinghao.li edited comment on WW-2156 at 8/29/08 8:05 PM:
---------------------------------------------------------

+1 for "name" attribute as required

PS : Well, can i have some good beer for the issue's one year birthday next week ? ;) 

      was (Author: yinghao.li):
    +1 for "name" attribute as required

PS : While, can i have some good beer for the issue's one year birthday next week ? ;) 
  
> double doubleselect without ids and name cause selection error
> --------------------------------------------------------------
>
>                 Key: WW-2156
>                 URL: https://issues.apache.org/struts/browse/WW-2156
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tags
>    Affects Versions: 2.0.9
>            Reporter: Yinghao LI
>             Fix For: 2.1.3
>
>
> When there are two doubleselect without id attributes, the selection of the first's first select while change the options of the second's second select.
> The problem is :
> the name and the id of doubleselect aren't required attributes. When they are both absent, the value of name and id is the form_name concat with "_". When we use two or more doubleselect,  struts will create same variables and function in javascript with the doubleselect.ftl in the simple template.
> Personnally, i think the id of doubleselect should use the doubleName's value when there is neither id attribute nor name attribute.
> <script type="text/javascript">
> <#assign itemCount = startCount/>
>     var ${parameters.id}Group = new Array(${parameters.listSize} + ${startCount});
>     for (i = 0; i < (${parameters.listSize} + ${startCount}); i++)
>     ${parameters.id}Group[i] = new Array();
> <@s.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
>     <#if parameters.listValue?exists>
>         <#assign itemValue = stack.findString(parameters.listValue)/>
>     <#else>
>         <#assign itemValue = stack.findString('top')/>
>     </#if>
>     <#assign doubleItemCount = 0/>
>     <@s.iterator value="${parameters.doubleList}">
>         <#if parameters.doubleListKey?exists>
>             <#assign doubleItemKey = stack.findValue(parameters.doubleListKey)/>
>         <#else>
>             <#assign doubleItemKey = stack.findValue('top')/>
>         </#if>
>         <#assign doubleItemKeyStr = doubleItemKey.toString() />
>         <#if parameters.doubleListValue?exists>
>             <#assign doubleItemValue = stack.findString(parameters.doubleListValue)/>
>         <#else>
>             <#assign doubleItemValue = stack.findString('top')/>
>         </#if>
>     ${parameters.id}Group[${itemCount}][${doubleItemCount}] = new Option("${doubleItemValue}", "${doubleItemKeyStr}");
>         <#assign doubleItemCount = doubleItemCount + 1/>
>     </...@s.iterator>
>     <#assign itemCount = itemCount + 1/>
> </...@s.iterator>
>     var ${parameters.id}Temp = document.${parameters.formName}.${parameters.doubleId};
> <#assign itemCount = startCount/>
> <#assign redirectTo = 0/>
> <@s.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
>     <#if tag.contains(parameters.nameValue, itemKey)>
>         <#assign redirectTo = itemCount/>
>     </#if>
>     <#assign itemCount = itemCount + 1/>
> </...@s.iterator>
>     ${parameters.id}Redirect(${redirectTo});
>     function ${parameters.id}Redirect(x) {
>     	var selected = false;
>         for (m = ${parameters.id}Temp.options.length - 1; m >= 0; m--) {
>             ${parameters.id}Temp.options[m] = null;
>         }
>         for (i = 0; i < ${parameters.id}Group[x].length; i++) {
>             ${parameters.id}Temp.options[i] = new Option(${parameters.id}Group[x][i].text, ${parameters.id}Group[x][i].value);
>             <#if parameters.doubleNameValue?exists>
>             	if (${parameters.id}Temp.options[i].value == '${parameters.doubleNameValue}') {
>             		${parameters.id}Temp.options[i].selected = true;
>             		selected = true;
>             	}
>             </#if>
>         }
>         if ((${parameters.id}Temp.options.length > 0) && (! selected)) {
>            	${parameters.id}Temp.options[0].selected = true;
>         }
>     }
> </script>

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


[jira] Commented: (WW-2156) double doubleselect without ids and name cause selection error

Posted by "Wes Wannemacher (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44621#action_44621 ] 

Wes Wannemacher commented on WW-2156:
-------------------------------------

Plus, if you are going to make a change, do it on DoubleListUIBean.java, since that will fix both the double select and the option transfer select tags.

> double doubleselect without ids and name cause selection error
> --------------------------------------------------------------
>
>                 Key: WW-2156
>                 URL: https://issues.apache.org/struts/browse/WW-2156
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tags
>    Affects Versions: 2.0.9
>            Reporter: Yinghao LI
>             Fix For: 2.1.3
>
>
> When there are two doubleselect without id attributes, the selection of the first's first select while change the options of the second's second select.
> The problem is :
> the name and the id of doubleselect aren't required attributes. When they are both absent, the value of name and id is the form_name concat with "_". When we use two or more doubleselect,  struts will create same variables and function in javascript with the doubleselect.ftl in the simple template.
> Personnally, i think the id of doubleselect should use the doubleName's value when there is neither id attribute nor name attribute.
> <script type="text/javascript">
> <#assign itemCount = startCount/>
>     var ${parameters.id}Group = new Array(${parameters.listSize} + ${startCount});
>     for (i = 0; i < (${parameters.listSize} + ${startCount}); i++)
>     ${parameters.id}Group[i] = new Array();
> <@s.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
>     <#if parameters.listValue?exists>
>         <#assign itemValue = stack.findString(parameters.listValue)/>
>     <#else>
>         <#assign itemValue = stack.findString('top')/>
>     </#if>
>     <#assign doubleItemCount = 0/>
>     <@s.iterator value="${parameters.doubleList}">
>         <#if parameters.doubleListKey?exists>
>             <#assign doubleItemKey = stack.findValue(parameters.doubleListKey)/>
>         <#else>
>             <#assign doubleItemKey = stack.findValue('top')/>
>         </#if>
>         <#assign doubleItemKeyStr = doubleItemKey.toString() />
>         <#if parameters.doubleListValue?exists>
>             <#assign doubleItemValue = stack.findString(parameters.doubleListValue)/>
>         <#else>
>             <#assign doubleItemValue = stack.findString('top')/>
>         </#if>
>     ${parameters.id}Group[${itemCount}][${doubleItemCount}] = new Option("${doubleItemValue}", "${doubleItemKeyStr}");
>         <#assign doubleItemCount = doubleItemCount + 1/>
>     </...@s.iterator>
>     <#assign itemCount = itemCount + 1/>
> </...@s.iterator>
>     var ${parameters.id}Temp = document.${parameters.formName}.${parameters.doubleId};
> <#assign itemCount = startCount/>
> <#assign redirectTo = 0/>
> <@s.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
>     <#if tag.contains(parameters.nameValue, itemKey)>
>         <#assign redirectTo = itemCount/>
>     </#if>
>     <#assign itemCount = itemCount + 1/>
> </...@s.iterator>
>     ${parameters.id}Redirect(${redirectTo});
>     function ${parameters.id}Redirect(x) {
>     	var selected = false;
>         for (m = ${parameters.id}Temp.options.length - 1; m >= 0; m--) {
>             ${parameters.id}Temp.options[m] = null;
>         }
>         for (i = 0; i < ${parameters.id}Group[x].length; i++) {
>             ${parameters.id}Temp.options[i] = new Option(${parameters.id}Group[x][i].text, ${parameters.id}Group[x][i].value);
>             <#if parameters.doubleNameValue?exists>
>             	if (${parameters.id}Temp.options[i].value == '${parameters.doubleNameValue}') {
>             		${parameters.id}Temp.options[i].selected = true;
>             		selected = true;
>             	}
>             </#if>
>         }
>         if ((${parameters.id}Temp.options.length > 0) && (! selected)) {
>            	${parameters.id}Temp.options[0].selected = true;
>         }
>     }
> </script>

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


[jira] Updated: (WW-2156) double doubleselect without ids and name cause selection error

Posted by "James Holmes (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2156?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Holmes updated WW-2156:
-----------------------------

    Fix Version/s:     (was: 2.0.11)
                   2.0.12

> double doubleselect without ids and name cause selection error
> --------------------------------------------------------------
>
>                 Key: WW-2156
>                 URL: https://issues.apache.org/struts/browse/WW-2156
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Views
>    Affects Versions: 2.0.9
>            Reporter: Yinghao LI
>             Fix For: 2.0.12
>
>
> When there are two doubleselect without id attributes, the selection of the first's first select while change the options of the second's second select.
> The problem is :
> the name and the id of doubleselect aren't required attributes. When they are both absent, the value of name and id is the form_name concat with "_". When we use two or more doubleselect,  struts will create same variables and function in javascript with the doubleselect.ftl in the simple template.
> Personnally, i think the id of doubleselect should use the doubleName's value when there is neither id attribute nor name attribute.
> <script type="text/javascript">
> <#assign itemCount = startCount/>
>     var ${parameters.id}Group = new Array(${parameters.listSize} + ${startCount});
>     for (i = 0; i < (${parameters.listSize} + ${startCount}); i++)
>     ${parameters.id}Group[i] = new Array();
> <@s.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
>     <#if parameters.listValue?exists>
>         <#assign itemValue = stack.findString(parameters.listValue)/>
>     <#else>
>         <#assign itemValue = stack.findString('top')/>
>     </#if>
>     <#assign doubleItemCount = 0/>
>     <@s.iterator value="${parameters.doubleList}">
>         <#if parameters.doubleListKey?exists>
>             <#assign doubleItemKey = stack.findValue(parameters.doubleListKey)/>
>         <#else>
>             <#assign doubleItemKey = stack.findValue('top')/>
>         </#if>
>         <#assign doubleItemKeyStr = doubleItemKey.toString() />
>         <#if parameters.doubleListValue?exists>
>             <#assign doubleItemValue = stack.findString(parameters.doubleListValue)/>
>         <#else>
>             <#assign doubleItemValue = stack.findString('top')/>
>         </#if>
>     ${parameters.id}Group[${itemCount}][${doubleItemCount}] = new Option("${doubleItemValue}", "${doubleItemKeyStr}");
>         <#assign doubleItemCount = doubleItemCount + 1/>
>     </...@s.iterator>
>     <#assign itemCount = itemCount + 1/>
> </...@s.iterator>
>     var ${parameters.id}Temp = document.${parameters.formName}.${parameters.doubleId};
> <#assign itemCount = startCount/>
> <#assign redirectTo = 0/>
> <@s.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
>     <#if tag.contains(parameters.nameValue, itemKey)>
>         <#assign redirectTo = itemCount/>
>     </#if>
>     <#assign itemCount = itemCount + 1/>
> </...@s.iterator>
>     ${parameters.id}Redirect(${redirectTo});
>     function ${parameters.id}Redirect(x) {
>     	var selected = false;
>         for (m = ${parameters.id}Temp.options.length - 1; m >= 0; m--) {
>             ${parameters.id}Temp.options[m] = null;
>         }
>         for (i = 0; i < ${parameters.id}Group[x].length; i++) {
>             ${parameters.id}Temp.options[i] = new Option(${parameters.id}Group[x][i].text, ${parameters.id}Group[x][i].value);
>             <#if parameters.doubleNameValue?exists>
>             	if (${parameters.id}Temp.options[i].value == '${parameters.doubleNameValue}') {
>             		${parameters.id}Temp.options[i].selected = true;
>             		selected = true;
>             	}
>             </#if>
>         }
>         if ((${parameters.id}Temp.options.length > 0) && (! selected)) {
>            	${parameters.id}Temp.options[0].selected = true;
>         }
>     }
> </script>

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


[jira] Updated: (WW-2156) double doubleselect without ids and name cause selection error

Posted by "James Holmes (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2156?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Holmes updated WW-2156:
-----------------------------

    Fix Version/s: 2.0.11

> double doubleselect without ids and name cause selection error
> --------------------------------------------------------------
>
>                 Key: WW-2156
>                 URL: https://issues.apache.org/struts/browse/WW-2156
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Views
>    Affects Versions: 2.0.9
>            Reporter: Yinghao LI
>             Fix For: 2.0.11
>
>
> When there are two doubleselect without id attributes, the selection of the first's first select while change the options of the second's second select.
> The problem is :
> the name and the id of doubleselect aren't required attributes. When they are both absent, the value of name and id is the form_name concat with "_". When we use two or more doubleselect,  struts will create same variables and function in javascript with the doubleselect.ftl in the simple template.
> Personnally, i think the id of doubleselect should use the doubleName's value when there is neither id attribute nor name attribute.
> <script type="text/javascript">
> <#assign itemCount = startCount/>
>     var ${parameters.id}Group = new Array(${parameters.listSize} + ${startCount});
>     for (i = 0; i < (${parameters.listSize} + ${startCount}); i++)
>     ${parameters.id}Group[i] = new Array();
> <@s.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
>     <#if parameters.listValue?exists>
>         <#assign itemValue = stack.findString(parameters.listValue)/>
>     <#else>
>         <#assign itemValue = stack.findString('top')/>
>     </#if>
>     <#assign doubleItemCount = 0/>
>     <@s.iterator value="${parameters.doubleList}">
>         <#if parameters.doubleListKey?exists>
>             <#assign doubleItemKey = stack.findValue(parameters.doubleListKey)/>
>         <#else>
>             <#assign doubleItemKey = stack.findValue('top')/>
>         </#if>
>         <#assign doubleItemKeyStr = doubleItemKey.toString() />
>         <#if parameters.doubleListValue?exists>
>             <#assign doubleItemValue = stack.findString(parameters.doubleListValue)/>
>         <#else>
>             <#assign doubleItemValue = stack.findString('top')/>
>         </#if>
>     ${parameters.id}Group[${itemCount}][${doubleItemCount}] = new Option("${doubleItemValue}", "${doubleItemKeyStr}");
>         <#assign doubleItemCount = doubleItemCount + 1/>
>     </...@s.iterator>
>     <#assign itemCount = itemCount + 1/>
> </...@s.iterator>
>     var ${parameters.id}Temp = document.${parameters.formName}.${parameters.doubleId};
> <#assign itemCount = startCount/>
> <#assign redirectTo = 0/>
> <@s.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
>     <#if tag.contains(parameters.nameValue, itemKey)>
>         <#assign redirectTo = itemCount/>
>     </#if>
>     <#assign itemCount = itemCount + 1/>
> </...@s.iterator>
>     ${parameters.id}Redirect(${redirectTo});
>     function ${parameters.id}Redirect(x) {
>     	var selected = false;
>         for (m = ${parameters.id}Temp.options.length - 1; m >= 0; m--) {
>             ${parameters.id}Temp.options[m] = null;
>         }
>         for (i = 0; i < ${parameters.id}Group[x].length; i++) {
>             ${parameters.id}Temp.options[i] = new Option(${parameters.id}Group[x][i].text, ${parameters.id}Group[x][i].value);
>             <#if parameters.doubleNameValue?exists>
>             	if (${parameters.id}Temp.options[i].value == '${parameters.doubleNameValue}') {
>             		${parameters.id}Temp.options[i].selected = true;
>             		selected = true;
>             	}
>             </#if>
>         }
>         if ((${parameters.id}Temp.options.length > 0) && (! selected)) {
>            	${parameters.id}Temp.options[0].selected = true;
>         }
>     }
> </script>

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


[jira] Updated: (WW-2156) double doubleselect without ids and name cause selection error

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2156?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Musachy Barroso updated WW-2156:
--------------------------------

    Fix Version/s:     (was: 2.1.3)
                   Future

moving to "future", pending patch

> double doubleselect without ids and name cause selection error
> --------------------------------------------------------------
>
>                 Key: WW-2156
>                 URL: https://issues.apache.org/struts/browse/WW-2156
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tags
>    Affects Versions: 2.0.9
>            Reporter: Yinghao LI
>             Fix For: Future
>
>
> When there are two doubleselect without id attributes, the selection of the first's first select while change the options of the second's second select.
> The problem is :
> the name and the id of doubleselect aren't required attributes. When they are both absent, the value of name and id is the form_name concat with "_". When we use two or more doubleselect,  struts will create same variables and function in javascript with the doubleselect.ftl in the simple template.
> Personnally, i think the id of doubleselect should use the doubleName's value when there is neither id attribute nor name attribute.
> <script type="text/javascript">
> <#assign itemCount = startCount/>
>     var ${parameters.id}Group = new Array(${parameters.listSize} + ${startCount});
>     for (i = 0; i < (${parameters.listSize} + ${startCount}); i++)
>     ${parameters.id}Group[i] = new Array();
> <@s.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
>     <#if parameters.listValue?exists>
>         <#assign itemValue = stack.findString(parameters.listValue)/>
>     <#else>
>         <#assign itemValue = stack.findString('top')/>
>     </#if>
>     <#assign doubleItemCount = 0/>
>     <@s.iterator value="${parameters.doubleList}">
>         <#if parameters.doubleListKey?exists>
>             <#assign doubleItemKey = stack.findValue(parameters.doubleListKey)/>
>         <#else>
>             <#assign doubleItemKey = stack.findValue('top')/>
>         </#if>
>         <#assign doubleItemKeyStr = doubleItemKey.toString() />
>         <#if parameters.doubleListValue?exists>
>             <#assign doubleItemValue = stack.findString(parameters.doubleListValue)/>
>         <#else>
>             <#assign doubleItemValue = stack.findString('top')/>
>         </#if>
>     ${parameters.id}Group[${itemCount}][${doubleItemCount}] = new Option("${doubleItemValue}", "${doubleItemKeyStr}");
>         <#assign doubleItemCount = doubleItemCount + 1/>
>     </...@s.iterator>
>     <#assign itemCount = itemCount + 1/>
> </...@s.iterator>
>     var ${parameters.id}Temp = document.${parameters.formName}.${parameters.doubleId};
> <#assign itemCount = startCount/>
> <#assign redirectTo = 0/>
> <@s.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
>     <#if tag.contains(parameters.nameValue, itemKey)>
>         <#assign redirectTo = itemCount/>
>     </#if>
>     <#assign itemCount = itemCount + 1/>
> </...@s.iterator>
>     ${parameters.id}Redirect(${redirectTo});
>     function ${parameters.id}Redirect(x) {
>     	var selected = false;
>         for (m = ${parameters.id}Temp.options.length - 1; m >= 0; m--) {
>             ${parameters.id}Temp.options[m] = null;
>         }
>         for (i = 0; i < ${parameters.id}Group[x].length; i++) {
>             ${parameters.id}Temp.options[i] = new Option(${parameters.id}Group[x][i].text, ${parameters.id}Group[x][i].value);
>             <#if parameters.doubleNameValue?exists>
>             	if (${parameters.id}Temp.options[i].value == '${parameters.doubleNameValue}') {
>             		${parameters.id}Temp.options[i].selected = true;
>             		selected = true;
>             	}
>             </#if>
>         }
>         if ((${parameters.id}Temp.options.length > 0) && (! selected)) {
>            	${parameters.id}Temp.options[0].selected = true;
>         }
>     }
> </script>

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


[jira] Commented: (WW-2156) double doubleselect without ids and name cause selection error

Posted by "Wes Wannemacher (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44616#action_44616 ] 

Wes Wannemacher commented on WW-2156:
-------------------------------------

James +1 for your suggestion, it seems like a workable solution for this an WW-2253 as well. IIRC, I had a similar problem with autocompleter - https://issues.apache.org/struts/browse/WW-2442

> double doubleselect without ids and name cause selection error
> --------------------------------------------------------------
>
>                 Key: WW-2156
>                 URL: https://issues.apache.org/struts/browse/WW-2156
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tags
>    Affects Versions: 2.0.9
>            Reporter: Yinghao LI
>             Fix For: 2.1.3
>
>
> When there are two doubleselect without id attributes, the selection of the first's first select while change the options of the second's second select.
> The problem is :
> the name and the id of doubleselect aren't required attributes. When they are both absent, the value of name and id is the form_name concat with "_". When we use two or more doubleselect,  struts will create same variables and function in javascript with the doubleselect.ftl in the simple template.
> Personnally, i think the id of doubleselect should use the doubleName's value when there is neither id attribute nor name attribute.
> <script type="text/javascript">
> <#assign itemCount = startCount/>
>     var ${parameters.id}Group = new Array(${parameters.listSize} + ${startCount});
>     for (i = 0; i < (${parameters.listSize} + ${startCount}); i++)
>     ${parameters.id}Group[i] = new Array();
> <@s.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
>     <#if parameters.listValue?exists>
>         <#assign itemValue = stack.findString(parameters.listValue)/>
>     <#else>
>         <#assign itemValue = stack.findString('top')/>
>     </#if>
>     <#assign doubleItemCount = 0/>
>     <@s.iterator value="${parameters.doubleList}">
>         <#if parameters.doubleListKey?exists>
>             <#assign doubleItemKey = stack.findValue(parameters.doubleListKey)/>
>         <#else>
>             <#assign doubleItemKey = stack.findValue('top')/>
>         </#if>
>         <#assign doubleItemKeyStr = doubleItemKey.toString() />
>         <#if parameters.doubleListValue?exists>
>             <#assign doubleItemValue = stack.findString(parameters.doubleListValue)/>
>         <#else>
>             <#assign doubleItemValue = stack.findString('top')/>
>         </#if>
>     ${parameters.id}Group[${itemCount}][${doubleItemCount}] = new Option("${doubleItemValue}", "${doubleItemKeyStr}");
>         <#assign doubleItemCount = doubleItemCount + 1/>
>     </...@s.iterator>
>     <#assign itemCount = itemCount + 1/>
> </...@s.iterator>
>     var ${parameters.id}Temp = document.${parameters.formName}.${parameters.doubleId};
> <#assign itemCount = startCount/>
> <#assign redirectTo = 0/>
> <@s.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
>     <#if tag.contains(parameters.nameValue, itemKey)>
>         <#assign redirectTo = itemCount/>
>     </#if>
>     <#assign itemCount = itemCount + 1/>
> </...@s.iterator>
>     ${parameters.id}Redirect(${redirectTo});
>     function ${parameters.id}Redirect(x) {
>     	var selected = false;
>         for (m = ${parameters.id}Temp.options.length - 1; m >= 0; m--) {
>             ${parameters.id}Temp.options[m] = null;
>         }
>         for (i = 0; i < ${parameters.id}Group[x].length; i++) {
>             ${parameters.id}Temp.options[i] = new Option(${parameters.id}Group[x][i].text, ${parameters.id}Group[x][i].value);
>             <#if parameters.doubleNameValue?exists>
>             	if (${parameters.id}Temp.options[i].value == '${parameters.doubleNameValue}') {
>             		${parameters.id}Temp.options[i].selected = true;
>             		selected = true;
>             	}
>             </#if>
>         }
>         if ((${parameters.id}Temp.options.length > 0) && (! selected)) {
>            	${parameters.id}Temp.options[0].selected = true;
>         }
>     }
> </script>

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


[jira] Commented: (WW-2156) double doubleselect without ids and name cause selection error

Posted by "Wes Wannemacher (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44620#action_44620 ] 

Wes Wannemacher commented on WW-2156:
-------------------------------------

It's trickier than it seems, the 'name' attribute is inherited all the way down from UIBean, where it isn't required. Yinghao, before you provide a patch that simply updates the TLD file, take a look at the the backing classes in /struts2/core/src/main/java/org/apache/struts2/components. It's pretty easy to figure out that the TLD file is generated based on Annotations in those classes. 

> double doubleselect without ids and name cause selection error
> --------------------------------------------------------------
>
>                 Key: WW-2156
>                 URL: https://issues.apache.org/struts/browse/WW-2156
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tags
>    Affects Versions: 2.0.9
>            Reporter: Yinghao LI
>             Fix For: 2.1.3
>
>
> When there are two doubleselect without id attributes, the selection of the first's first select while change the options of the second's second select.
> The problem is :
> the name and the id of doubleselect aren't required attributes. When they are both absent, the value of name and id is the form_name concat with "_". When we use two or more doubleselect,  struts will create same variables and function in javascript with the doubleselect.ftl in the simple template.
> Personnally, i think the id of doubleselect should use the doubleName's value when there is neither id attribute nor name attribute.
> <script type="text/javascript">
> <#assign itemCount = startCount/>
>     var ${parameters.id}Group = new Array(${parameters.listSize} + ${startCount});
>     for (i = 0; i < (${parameters.listSize} + ${startCount}); i++)
>     ${parameters.id}Group[i] = new Array();
> <@s.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
>     <#if parameters.listValue?exists>
>         <#assign itemValue = stack.findString(parameters.listValue)/>
>     <#else>
>         <#assign itemValue = stack.findString('top')/>
>     </#if>
>     <#assign doubleItemCount = 0/>
>     <@s.iterator value="${parameters.doubleList}">
>         <#if parameters.doubleListKey?exists>
>             <#assign doubleItemKey = stack.findValue(parameters.doubleListKey)/>
>         <#else>
>             <#assign doubleItemKey = stack.findValue('top')/>
>         </#if>
>         <#assign doubleItemKeyStr = doubleItemKey.toString() />
>         <#if parameters.doubleListValue?exists>
>             <#assign doubleItemValue = stack.findString(parameters.doubleListValue)/>
>         <#else>
>             <#assign doubleItemValue = stack.findString('top')/>
>         </#if>
>     ${parameters.id}Group[${itemCount}][${doubleItemCount}] = new Option("${doubleItemValue}", "${doubleItemKeyStr}");
>         <#assign doubleItemCount = doubleItemCount + 1/>
>     </...@s.iterator>
>     <#assign itemCount = itemCount + 1/>
> </...@s.iterator>
>     var ${parameters.id}Temp = document.${parameters.formName}.${parameters.doubleId};
> <#assign itemCount = startCount/>
> <#assign redirectTo = 0/>
> <@s.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
>     <#if tag.contains(parameters.nameValue, itemKey)>
>         <#assign redirectTo = itemCount/>
>     </#if>
>     <#assign itemCount = itemCount + 1/>
> </...@s.iterator>
>     ${parameters.id}Redirect(${redirectTo});
>     function ${parameters.id}Redirect(x) {
>     	var selected = false;
>         for (m = ${parameters.id}Temp.options.length - 1; m >= 0; m--) {
>             ${parameters.id}Temp.options[m] = null;
>         }
>         for (i = 0; i < ${parameters.id}Group[x].length; i++) {
>             ${parameters.id}Temp.options[i] = new Option(${parameters.id}Group[x][i].text, ${parameters.id}Group[x][i].value);
>             <#if parameters.doubleNameValue?exists>
>             	if (${parameters.id}Temp.options[i].value == '${parameters.doubleNameValue}') {
>             		${parameters.id}Temp.options[i].selected = true;
>             		selected = true;
>             	}
>             </#if>
>         }
>         if ((${parameters.id}Temp.options.length > 0) && (! selected)) {
>            	${parameters.id}Temp.options[0].selected = true;
>         }
>     }
> </script>

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


[jira] Commented: (WW-2156) double doubleselect without ids and name cause selection error

Posted by "Yinghao LI (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44622#action_44622 ] 

Yinghao LI commented on WW-2156:
--------------------------------

i can provide patch even if i'm not committer ?

> double doubleselect without ids and name cause selection error
> --------------------------------------------------------------
>
>                 Key: WW-2156
>                 URL: https://issues.apache.org/struts/browse/WW-2156
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tags
>    Affects Versions: 2.0.9
>            Reporter: Yinghao LI
>             Fix For: 2.1.3
>
>
> When there are two doubleselect without id attributes, the selection of the first's first select while change the options of the second's second select.
> The problem is :
> the name and the id of doubleselect aren't required attributes. When they are both absent, the value of name and id is the form_name concat with "_". When we use two or more doubleselect,  struts will create same variables and function in javascript with the doubleselect.ftl in the simple template.
> Personnally, i think the id of doubleselect should use the doubleName's value when there is neither id attribute nor name attribute.
> <script type="text/javascript">
> <#assign itemCount = startCount/>
>     var ${parameters.id}Group = new Array(${parameters.listSize} + ${startCount});
>     for (i = 0; i < (${parameters.listSize} + ${startCount}); i++)
>     ${parameters.id}Group[i] = new Array();
> <@s.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
>     <#if parameters.listValue?exists>
>         <#assign itemValue = stack.findString(parameters.listValue)/>
>     <#else>
>         <#assign itemValue = stack.findString('top')/>
>     </#if>
>     <#assign doubleItemCount = 0/>
>     <@s.iterator value="${parameters.doubleList}">
>         <#if parameters.doubleListKey?exists>
>             <#assign doubleItemKey = stack.findValue(parameters.doubleListKey)/>
>         <#else>
>             <#assign doubleItemKey = stack.findValue('top')/>
>         </#if>
>         <#assign doubleItemKeyStr = doubleItemKey.toString() />
>         <#if parameters.doubleListValue?exists>
>             <#assign doubleItemValue = stack.findString(parameters.doubleListValue)/>
>         <#else>
>             <#assign doubleItemValue = stack.findString('top')/>
>         </#if>
>     ${parameters.id}Group[${itemCount}][${doubleItemCount}] = new Option("${doubleItemValue}", "${doubleItemKeyStr}");
>         <#assign doubleItemCount = doubleItemCount + 1/>
>     </...@s.iterator>
>     <#assign itemCount = itemCount + 1/>
> </...@s.iterator>
>     var ${parameters.id}Temp = document.${parameters.formName}.${parameters.doubleId};
> <#assign itemCount = startCount/>
> <#assign redirectTo = 0/>
> <@s.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
>     <#if tag.contains(parameters.nameValue, itemKey)>
>         <#assign redirectTo = itemCount/>
>     </#if>
>     <#assign itemCount = itemCount + 1/>
> </...@s.iterator>
>     ${parameters.id}Redirect(${redirectTo});
>     function ${parameters.id}Redirect(x) {
>     	var selected = false;
>         for (m = ${parameters.id}Temp.options.length - 1; m >= 0; m--) {
>             ${parameters.id}Temp.options[m] = null;
>         }
>         for (i = 0; i < ${parameters.id}Group[x].length; i++) {
>             ${parameters.id}Temp.options[i] = new Option(${parameters.id}Group[x][i].text, ${parameters.id}Group[x][i].value);
>             <#if parameters.doubleNameValue?exists>
>             	if (${parameters.id}Temp.options[i].value == '${parameters.doubleNameValue}') {
>             		${parameters.id}Temp.options[i].selected = true;
>             		selected = true;
>             	}
>             </#if>
>         }
>         if ((${parameters.id}Temp.options.length > 0) && (! selected)) {
>            	${parameters.id}Temp.options[0].selected = true;
>         }
>     }
> </script>

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


[jira] Commented: (WW-2156) double doubleselect without ids and name cause selection error

Posted by "Yinghao LI (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44618#action_44618 ] 

Yinghao LI commented on WW-2156:
--------------------------------

+1 for "name" attribute as required

PS : While, can i have some good beer for the issue's one year birthday next week ? ;) 

> double doubleselect without ids and name cause selection error
> --------------------------------------------------------------
>
>                 Key: WW-2156
>                 URL: https://issues.apache.org/struts/browse/WW-2156
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tags
>    Affects Versions: 2.0.9
>            Reporter: Yinghao LI
>             Fix For: 2.1.3
>
>
> When there are two doubleselect without id attributes, the selection of the first's first select while change the options of the second's second select.
> The problem is :
> the name and the id of doubleselect aren't required attributes. When they are both absent, the value of name and id is the form_name concat with "_". When we use two or more doubleselect,  struts will create same variables and function in javascript with the doubleselect.ftl in the simple template.
> Personnally, i think the id of doubleselect should use the doubleName's value when there is neither id attribute nor name attribute.
> <script type="text/javascript">
> <#assign itemCount = startCount/>
>     var ${parameters.id}Group = new Array(${parameters.listSize} + ${startCount});
>     for (i = 0; i < (${parameters.listSize} + ${startCount}); i++)
>     ${parameters.id}Group[i] = new Array();
> <@s.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
>     <#if parameters.listValue?exists>
>         <#assign itemValue = stack.findString(parameters.listValue)/>
>     <#else>
>         <#assign itemValue = stack.findString('top')/>
>     </#if>
>     <#assign doubleItemCount = 0/>
>     <@s.iterator value="${parameters.doubleList}">
>         <#if parameters.doubleListKey?exists>
>             <#assign doubleItemKey = stack.findValue(parameters.doubleListKey)/>
>         <#else>
>             <#assign doubleItemKey = stack.findValue('top')/>
>         </#if>
>         <#assign doubleItemKeyStr = doubleItemKey.toString() />
>         <#if parameters.doubleListValue?exists>
>             <#assign doubleItemValue = stack.findString(parameters.doubleListValue)/>
>         <#else>
>             <#assign doubleItemValue = stack.findString('top')/>
>         </#if>
>     ${parameters.id}Group[${itemCount}][${doubleItemCount}] = new Option("${doubleItemValue}", "${doubleItemKeyStr}");
>         <#assign doubleItemCount = doubleItemCount + 1/>
>     </...@s.iterator>
>     <#assign itemCount = itemCount + 1/>
> </...@s.iterator>
>     var ${parameters.id}Temp = document.${parameters.formName}.${parameters.doubleId};
> <#assign itemCount = startCount/>
> <#assign redirectTo = 0/>
> <@s.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
>     <#if tag.contains(parameters.nameValue, itemKey)>
>         <#assign redirectTo = itemCount/>
>     </#if>
>     <#assign itemCount = itemCount + 1/>
> </...@s.iterator>
>     ${parameters.id}Redirect(${redirectTo});
>     function ${parameters.id}Redirect(x) {
>     	var selected = false;
>         for (m = ${parameters.id}Temp.options.length - 1; m >= 0; m--) {
>             ${parameters.id}Temp.options[m] = null;
>         }
>         for (i = 0; i < ${parameters.id}Group[x].length; i++) {
>             ${parameters.id}Temp.options[i] = new Option(${parameters.id}Group[x][i].text, ${parameters.id}Group[x][i].value);
>             <#if parameters.doubleNameValue?exists>
>             	if (${parameters.id}Temp.options[i].value == '${parameters.doubleNameValue}') {
>             		${parameters.id}Temp.options[i].selected = true;
>             		selected = true;
>             	}
>             </#if>
>         }
>         if ((${parameters.id}Temp.options.length > 0) && (! selected)) {
>            	${parameters.id}Temp.options[0].selected = true;
>         }
>     }
> </script>

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


[jira] Commented: (WW-2156) double doubleselect without ids and name cause selection error

Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44617#action_44617 ] 

Dave Newton commented on WW-2156:
---------------------------------

IMO it's actually a little backwards, the naming. the "doubleName" is what ends up being set on the action. Personally I think the "name" attribute should be the required one, and it's the name of the action property that gets set. doubleName should be optional, and if not supplied, built from the "name" attribute, although I'm not sure how it'd be useful.

> double doubleselect without ids and name cause selection error
> --------------------------------------------------------------
>
>                 Key: WW-2156
>                 URL: https://issues.apache.org/struts/browse/WW-2156
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tags
>    Affects Versions: 2.0.9
>            Reporter: Yinghao LI
>             Fix For: 2.1.3
>
>
> When there are two doubleselect without id attributes, the selection of the first's first select while change the options of the second's second select.
> The problem is :
> the name and the id of doubleselect aren't required attributes. When they are both absent, the value of name and id is the form_name concat with "_". When we use two or more doubleselect,  struts will create same variables and function in javascript with the doubleselect.ftl in the simple template.
> Personnally, i think the id of doubleselect should use the doubleName's value when there is neither id attribute nor name attribute.
> <script type="text/javascript">
> <#assign itemCount = startCount/>
>     var ${parameters.id}Group = new Array(${parameters.listSize} + ${startCount});
>     for (i = 0; i < (${parameters.listSize} + ${startCount}); i++)
>     ${parameters.id}Group[i] = new Array();
> <@s.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
>     <#if parameters.listValue?exists>
>         <#assign itemValue = stack.findString(parameters.listValue)/>
>     <#else>
>         <#assign itemValue = stack.findString('top')/>
>     </#if>
>     <#assign doubleItemCount = 0/>
>     <@s.iterator value="${parameters.doubleList}">
>         <#if parameters.doubleListKey?exists>
>             <#assign doubleItemKey = stack.findValue(parameters.doubleListKey)/>
>         <#else>
>             <#assign doubleItemKey = stack.findValue('top')/>
>         </#if>
>         <#assign doubleItemKeyStr = doubleItemKey.toString() />
>         <#if parameters.doubleListValue?exists>
>             <#assign doubleItemValue = stack.findString(parameters.doubleListValue)/>
>         <#else>
>             <#assign doubleItemValue = stack.findString('top')/>
>         </#if>
>     ${parameters.id}Group[${itemCount}][${doubleItemCount}] = new Option("${doubleItemValue}", "${doubleItemKeyStr}");
>         <#assign doubleItemCount = doubleItemCount + 1/>
>     </...@s.iterator>
>     <#assign itemCount = itemCount + 1/>
> </...@s.iterator>
>     var ${parameters.id}Temp = document.${parameters.formName}.${parameters.doubleId};
> <#assign itemCount = startCount/>
> <#assign redirectTo = 0/>
> <@s.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
>     <#if tag.contains(parameters.nameValue, itemKey)>
>         <#assign redirectTo = itemCount/>
>     </#if>
>     <#assign itemCount = itemCount + 1/>
> </...@s.iterator>
>     ${parameters.id}Redirect(${redirectTo});
>     function ${parameters.id}Redirect(x) {
>     	var selected = false;
>         for (m = ${parameters.id}Temp.options.length - 1; m >= 0; m--) {
>             ${parameters.id}Temp.options[m] = null;
>         }
>         for (i = 0; i < ${parameters.id}Group[x].length; i++) {
>             ${parameters.id}Temp.options[i] = new Option(${parameters.id}Group[x][i].text, ${parameters.id}Group[x][i].value);
>             <#if parameters.doubleNameValue?exists>
>             	if (${parameters.id}Temp.options[i].value == '${parameters.doubleNameValue}') {
>             		${parameters.id}Temp.options[i].selected = true;
>             		selected = true;
>             	}
>             </#if>
>         }
>         if ((${parameters.id}Temp.options.length > 0) && (! selected)) {
>            	${parameters.id}Temp.options[0].selected = true;
>         }
>     }
> </script>

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


[jira] Commented: (WW-2156) double doubleselect without ids and name cause selection error

Posted by "James Holmes (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43858#action_43858 ] 

James Holmes commented on WW-2156:
----------------------------------

I have verified this issue and it is indeed a problem. It is also a problem for the Options Transfer Select component as well. In my opinion, the "name" attribute should be required on both of these tags. That would fix the problem. Any reason not to require the "name" attribute when we are already requiring the "doubleName" attribute? Why require "doubleName" if "name" isn't required? I'm not sure what the logic is there.

> double doubleselect without ids and name cause selection error
> --------------------------------------------------------------
>
>                 Key: WW-2156
>                 URL: https://issues.apache.org/struts/browse/WW-2156
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tags
>    Affects Versions: 2.0.9
>            Reporter: Yinghao LI
>             Fix For: 2.1.3
>
>
> When there are two doubleselect without id attributes, the selection of the first's first select while change the options of the second's second select.
> The problem is :
> the name and the id of doubleselect aren't required attributes. When they are both absent, the value of name and id is the form_name concat with "_". When we use two or more doubleselect,  struts will create same variables and function in javascript with the doubleselect.ftl in the simple template.
> Personnally, i think the id of doubleselect should use the doubleName's value when there is neither id attribute nor name attribute.
> <script type="text/javascript">
> <#assign itemCount = startCount/>
>     var ${parameters.id}Group = new Array(${parameters.listSize} + ${startCount});
>     for (i = 0; i < (${parameters.listSize} + ${startCount}); i++)
>     ${parameters.id}Group[i] = new Array();
> <@s.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
>     <#if parameters.listValue?exists>
>         <#assign itemValue = stack.findString(parameters.listValue)/>
>     <#else>
>         <#assign itemValue = stack.findString('top')/>
>     </#if>
>     <#assign doubleItemCount = 0/>
>     <@s.iterator value="${parameters.doubleList}">
>         <#if parameters.doubleListKey?exists>
>             <#assign doubleItemKey = stack.findValue(parameters.doubleListKey)/>
>         <#else>
>             <#assign doubleItemKey = stack.findValue('top')/>
>         </#if>
>         <#assign doubleItemKeyStr = doubleItemKey.toString() />
>         <#if parameters.doubleListValue?exists>
>             <#assign doubleItemValue = stack.findString(parameters.doubleListValue)/>
>         <#else>
>             <#assign doubleItemValue = stack.findString('top')/>
>         </#if>
>     ${parameters.id}Group[${itemCount}][${doubleItemCount}] = new Option("${doubleItemValue}", "${doubleItemKeyStr}");
>         <#assign doubleItemCount = doubleItemCount + 1/>
>     </...@s.iterator>
>     <#assign itemCount = itemCount + 1/>
> </...@s.iterator>
>     var ${parameters.id}Temp = document.${parameters.formName}.${parameters.doubleId};
> <#assign itemCount = startCount/>
> <#assign redirectTo = 0/>
> <@s.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
>     <#if tag.contains(parameters.nameValue, itemKey)>
>         <#assign redirectTo = itemCount/>
>     </#if>
>     <#assign itemCount = itemCount + 1/>
> </...@s.iterator>
>     ${parameters.id}Redirect(${redirectTo});
>     function ${parameters.id}Redirect(x) {
>     	var selected = false;
>         for (m = ${parameters.id}Temp.options.length - 1; m >= 0; m--) {
>             ${parameters.id}Temp.options[m] = null;
>         }
>         for (i = 0; i < ${parameters.id}Group[x].length; i++) {
>             ${parameters.id}Temp.options[i] = new Option(${parameters.id}Group[x][i].text, ${parameters.id}Group[x][i].value);
>             <#if parameters.doubleNameValue?exists>
>             	if (${parameters.id}Temp.options[i].value == '${parameters.doubleNameValue}') {
>             		${parameters.id}Temp.options[i].selected = true;
>             		selected = true;
>             	}
>             </#if>
>         }
>         if ((${parameters.id}Temp.options.length > 0) && (! selected)) {
>            	${parameters.id}Temp.options[0].selected = true;
>         }
>     }
> </script>

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


[jira] Commented: (WW-2156) double doubleselect without ids and name cause selection error

Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44619#action_44619 ] 

Dave Newton commented on WW-2156:
---------------------------------

一瓶啤酒 (or maybe two if you provide a patch ;)

> double doubleselect without ids and name cause selection error
> --------------------------------------------------------------
>
>                 Key: WW-2156
>                 URL: https://issues.apache.org/struts/browse/WW-2156
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tags
>    Affects Versions: 2.0.9
>            Reporter: Yinghao LI
>             Fix For: 2.1.3
>
>
> When there are two doubleselect without id attributes, the selection of the first's first select while change the options of the second's second select.
> The problem is :
> the name and the id of doubleselect aren't required attributes. When they are both absent, the value of name and id is the form_name concat with "_". When we use two or more doubleselect,  struts will create same variables and function in javascript with the doubleselect.ftl in the simple template.
> Personnally, i think the id of doubleselect should use the doubleName's value when there is neither id attribute nor name attribute.
> <script type="text/javascript">
> <#assign itemCount = startCount/>
>     var ${parameters.id}Group = new Array(${parameters.listSize} + ${startCount});
>     for (i = 0; i < (${parameters.listSize} + ${startCount}); i++)
>     ${parameters.id}Group[i] = new Array();
> <@s.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
>     <#if parameters.listValue?exists>
>         <#assign itemValue = stack.findString(parameters.listValue)/>
>     <#else>
>         <#assign itemValue = stack.findString('top')/>
>     </#if>
>     <#assign doubleItemCount = 0/>
>     <@s.iterator value="${parameters.doubleList}">
>         <#if parameters.doubleListKey?exists>
>             <#assign doubleItemKey = stack.findValue(parameters.doubleListKey)/>
>         <#else>
>             <#assign doubleItemKey = stack.findValue('top')/>
>         </#if>
>         <#assign doubleItemKeyStr = doubleItemKey.toString() />
>         <#if parameters.doubleListValue?exists>
>             <#assign doubleItemValue = stack.findString(parameters.doubleListValue)/>
>         <#else>
>             <#assign doubleItemValue = stack.findString('top')/>
>         </#if>
>     ${parameters.id}Group[${itemCount}][${doubleItemCount}] = new Option("${doubleItemValue}", "${doubleItemKeyStr}");
>         <#assign doubleItemCount = doubleItemCount + 1/>
>     </...@s.iterator>
>     <#assign itemCount = itemCount + 1/>
> </...@s.iterator>
>     var ${parameters.id}Temp = document.${parameters.formName}.${parameters.doubleId};
> <#assign itemCount = startCount/>
> <#assign redirectTo = 0/>
> <@s.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
>     <#if tag.contains(parameters.nameValue, itemKey)>
>         <#assign redirectTo = itemCount/>
>     </#if>
>     <#assign itemCount = itemCount + 1/>
> </...@s.iterator>
>     ${parameters.id}Redirect(${redirectTo});
>     function ${parameters.id}Redirect(x) {
>     	var selected = false;
>         for (m = ${parameters.id}Temp.options.length - 1; m >= 0; m--) {
>             ${parameters.id}Temp.options[m] = null;
>         }
>         for (i = 0; i < ${parameters.id}Group[x].length; i++) {
>             ${parameters.id}Temp.options[i] = new Option(${parameters.id}Group[x][i].text, ${parameters.id}Group[x][i].value);
>             <#if parameters.doubleNameValue?exists>
>             	if (${parameters.id}Temp.options[i].value == '${parameters.doubleNameValue}') {
>             		${parameters.id}Temp.options[i].selected = true;
>             		selected = true;
>             	}
>             </#if>
>         }
>         if ((${parameters.id}Temp.options.length > 0) && (! selected)) {
>            	${parameters.id}Temp.options[0].selected = true;
>         }
>     }
> </script>

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


[jira] Commented: (WW-2156) double doubleselect without ids and name cause selection error

Posted by "Dave Newton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44623#action_44623 ] 

Dave Newton commented on WW-2156:
---------------------------------

Anybody can provide a patch; t gets reviewed, possibly applied, etc.

Like Wes said, though, it's not as straight-forward as it seems... probably can only do what you said in the first place and use the doubleName attribute if name/id are missing.

> double doubleselect without ids and name cause selection error
> --------------------------------------------------------------
>
>                 Key: WW-2156
>                 URL: https://issues.apache.org/struts/browse/WW-2156
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - Tags
>    Affects Versions: 2.0.9
>            Reporter: Yinghao LI
>             Fix For: 2.1.3
>
>
> When there are two doubleselect without id attributes, the selection of the first's first select while change the options of the second's second select.
> The problem is :
> the name and the id of doubleselect aren't required attributes. When they are both absent, the value of name and id is the form_name concat with "_". When we use two or more doubleselect,  struts will create same variables and function in javascript with the doubleselect.ftl in the simple template.
> Personnally, i think the id of doubleselect should use the doubleName's value when there is neither id attribute nor name attribute.
> <script type="text/javascript">
> <#assign itemCount = startCount/>
>     var ${parameters.id}Group = new Array(${parameters.listSize} + ${startCount});
>     for (i = 0; i < (${parameters.listSize} + ${startCount}); i++)
>     ${parameters.id}Group[i] = new Array();
> <@s.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
>     <#if parameters.listValue?exists>
>         <#assign itemValue = stack.findString(parameters.listValue)/>
>     <#else>
>         <#assign itemValue = stack.findString('top')/>
>     </#if>
>     <#assign doubleItemCount = 0/>
>     <@s.iterator value="${parameters.doubleList}">
>         <#if parameters.doubleListKey?exists>
>             <#assign doubleItemKey = stack.findValue(parameters.doubleListKey)/>
>         <#else>
>             <#assign doubleItemKey = stack.findValue('top')/>
>         </#if>
>         <#assign doubleItemKeyStr = doubleItemKey.toString() />
>         <#if parameters.doubleListValue?exists>
>             <#assign doubleItemValue = stack.findString(parameters.doubleListValue)/>
>         <#else>
>             <#assign doubleItemValue = stack.findString('top')/>
>         </#if>
>     ${parameters.id}Group[${itemCount}][${doubleItemCount}] = new Option("${doubleItemValue}", "${doubleItemKeyStr}");
>         <#assign doubleItemCount = doubleItemCount + 1/>
>     </...@s.iterator>
>     <#assign itemCount = itemCount + 1/>
> </...@s.iterator>
>     var ${parameters.id}Temp = document.${parameters.formName}.${parameters.doubleId};
> <#assign itemCount = startCount/>
> <#assign redirectTo = 0/>
> <@s.iterator value="parameters.list">
>     <#if parameters.listKey?exists>
>         <#assign itemKey = stack.findValue(parameters.listKey)/>
>     <#else>
>         <#assign itemKey = stack.findValue('top')/>
>     </#if>
>     <#if tag.contains(parameters.nameValue, itemKey)>
>         <#assign redirectTo = itemCount/>
>     </#if>
>     <#assign itemCount = itemCount + 1/>
> </...@s.iterator>
>     ${parameters.id}Redirect(${redirectTo});
>     function ${parameters.id}Redirect(x) {
>     	var selected = false;
>         for (m = ${parameters.id}Temp.options.length - 1; m >= 0; m--) {
>             ${parameters.id}Temp.options[m] = null;
>         }
>         for (i = 0; i < ${parameters.id}Group[x].length; i++) {
>             ${parameters.id}Temp.options[i] = new Option(${parameters.id}Group[x][i].text, ${parameters.id}Group[x][i].value);
>             <#if parameters.doubleNameValue?exists>
>             	if (${parameters.id}Temp.options[i].value == '${parameters.doubleNameValue}') {
>             		${parameters.id}Temp.options[i].selected = true;
>             		selected = true;
>             	}
>             </#if>
>         }
>         if ((${parameters.id}Temp.options.length > 0) && (! selected)) {
>            	${parameters.id}Temp.options[0].selected = true;
>         }
>     }
> </script>

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