History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: WW-1361
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Rainer Hermanns
Reporter: J. Longman
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
WebWork

ww:doubleselect javascript uses name instead of id, resulting in array names that don't work

Created: 27/Sep/06 05:15 PM   Updated: 07/Feb/07 09:15 PM
Component/s: Views
Affects Version/s: 2.2.2, 2.2.3, 2.2.4
Fix Version/s: 2.2.5

Flags: Patch


 Description  « Hide
doubleSelect template uses the name as the part of a javascript variable name, so when you use an ognl-style variable reference, the Group and Temp variables fail to work
----------------
See (from 2.2.2)
simple/doubleselect.ftl +38:
  var ${parameters.name}Group = new Array(${parameters.listSize} + ${startCount});
    for (i = 0; i < (${parameters.listSize} + ${startCount}); i++)
    ${parameters.name}Group[i] = new Array();
  .... +72
 var ${parameters.name}Temp = document.${parameters.formName}.${parameters.doubleName};
<#assign itemCount = startCount/>
<#assign redirectTo = 0/>

so if in your jsp you use:
<ww:doubleselect
   ...
  name="foo.bar.id"
   .../>

the generated javascript looks like

var foo.bar.idGroup = new Array(etc.)
  ....
 var foo.bar.idTemp = document.myForm.doubleName

------------------------


${parameters.name} should probably be ${parameters.id}

 All   Comments   Change History      Sort Order:
J. Longman - [27/Sep/06 05:23 PM ]
i.e. notwithstanding escaping characters:

s/ ${parameters.name}Group/ ${parameters.id}Group/g
s/ ${parameters.name}Temp/ ${parameters.id}Temp/g
also
s/ ${parameters.name}Redirect/ ${parameters.id}Redirect/

J. Longman - [29/Sep/06 06:04 PM ]
persuant to working around WW-1138 and WW-1139, I realized that my comment above is not good enough - the first <select> still introduces problems

I'm wondering if instead of using name, a s/./[some valid character]/g on ${parameters.name} might be a better solution - this would make this easier to use.

e.g.
   foo.bar.idTemp would become foo_bar_idTemp - assuming '_' is valid


Tom Schneider - [07/Feb/07 09:13 PM ]
Patches reviewed and applied.

Tom Schneider - [07/Feb/07 09:15 PM ]
Actually, I meant to type, the fix for this was backported from struts2.