You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "James Hartleroad (Jira)" <ji...@apache.org> on 2022/10/05 17:24:00 UTC

[jira] [Updated] (WW-5240) doubleOnchange attribute of the doubleselect tag doesn't call method

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

James Hartleroad updated WW-5240:
---------------------------------
    Description: 
When setting up a doubleselect tag with a call to a java script on the doubleOnchange attribute, the java script is not called.

For example a jsp with the following doubleselect

<s:doubleselect label="relbuild" 
                    id="selectapp" name="selectapp" list="appreleaseMap.keySet()" onchange="app2select()"
                    doubleId="selectrel" doubleName="selectrel" doubleList="appreleaseMap.get(top)"
                    doubleOnchange="rel2select()" />

and a java script file with (alerts added for debugging)

function app2select()

{     alert('app2select');     var elmnt = document.getElementById('selectapp');     var value = elmnt.value;     alert('value is:' + value);     document.getElementById('applid').value = value;     document.getElementById('release').value = ''; }

function rel2select()

{     alert('rel2select');     var elmnt = document.getElementById('selectrel');     var value = elmnt.value;     alert('value=' + value);     document.getElementById('release').value = value; }

The app2select is called when selecting the first element, but the rel2select is not called when selecting the 2nd element.

Per information I found on the web I updated the template/simple2/doubleselect.ftl by adding the following and then it worked. 

<#if parameters.doubleOnchange??><#t/>
    onchange="<#outputformat 'JavaScript'>${parameters.doubleOnchange}</#outputformat>"
    </#if><#t/>

  was:
When setting up a doubleselect tag with a call to a java script on the doubleOnchange attribute, the java script is not called.

For example a jsp with the following doubleselect

<s:doubleselect label="relbuild" 
                    id="selectapp" name="selectapp" list="appreleaseMap.keySet()" onchange="app2select()"
                    doubleId="selectrel" doubleName="selectrel" doubleList="appreleaseMap.get(top)"
                    doubleOnchange="rel2select()" />

and a java script file with (alerts added for debugging)

function app2select() {
    alert('app2select');
    var elmnt = document.getElementById('selectapp');
    var value = elmnt.value;
    alert('value is:' + value);
    document.getElementById('applid').value = value;
    document.getElementById('release').value = '';
}
function rel2select() {
    alert('rel2select');
    var elmnt = document.getElementById('selectrel');
    var value = elmnt.value;
    alert('value=' + value);
    document.getElementById('release').value = value;
}

The app2select is called when selecting the first element, but the rel2select is not called when selecting the 2nd element.

Per information I found on the web I updated the doubleselect.ftl by adding the following and then it worked. 

<#if parameters.doubleOnchange??><#t/>
    onchange="<#outputformat 'JavaScript'>${parameters.doubleOnchange}</#outputformat>"
    </#if><#t/>


> doubleOnchange attribute of the doubleselect tag doesn't call method
> --------------------------------------------------------------------
>
>                 Key: WW-5240
>                 URL: https://issues.apache.org/jira/browse/WW-5240
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 6.0.0
>            Reporter: James Hartleroad
>            Priority: Minor
>
> When setting up a doubleselect tag with a call to a java script on the doubleOnchange attribute, the java script is not called.
> For example a jsp with the following doubleselect
> <s:doubleselect label="relbuild" 
>                     id="selectapp" name="selectapp" list="appreleaseMap.keySet()" onchange="app2select()"
>                     doubleId="selectrel" doubleName="selectrel" doubleList="appreleaseMap.get(top)"
>                     doubleOnchange="rel2select()" />
> and a java script file with (alerts added for debugging)
> function app2select()
> {     alert('app2select');     var elmnt = document.getElementById('selectapp');     var value = elmnt.value;     alert('value is:' + value);     document.getElementById('applid').value = value;     document.getElementById('release').value = ''; }
> function rel2select()
> {     alert('rel2select');     var elmnt = document.getElementById('selectrel');     var value = elmnt.value;     alert('value=' + value);     document.getElementById('release').value = value; }
> The app2select is called when selecting the first element, but the rel2select is not called when selecting the 2nd element.
> Per information I found on the web I updated the template/simple2/doubleselect.ftl by adding the following and then it worked. 
> <#if parameters.doubleOnchange??><#t/>
>     onchange="<#outputformat 'JavaScript'>${parameters.doubleOnchange}</#outputformat>"
>     </#if><#t/>



--
This message was sent by Atlassian Jira
(v8.20.10#820010)