Author: musachy Date: Thu May 17 14:05:23 2007 New Revision: 539115 URL: http://svn.apache.org/viewvc?view=rev&rev=539115 Log: WW-1858 combobox template is not correct when there is '.' in the name attribute (use id instead of name)
Modified: struts/struts2/trunk/core/src/main/resources/template/simple/combobox.ftl struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ComboBoxTest.java struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/ComboBox-1.txt Modified: struts/struts2/trunk/core/src/main/resources/template/simple/combobox.ftl URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/simple/combobox.ftl?view=diff&rev=539115&r1=539114&r2=539115 ============================================================================== --- struts/struts2/trunk/core/src/main/resources/template/simple/combobox.ftl (original) +++ struts/struts2/trunk/core/src/main/resources/template/simple/combobox.ftl Thu May 17 14:05:23 2007 @@ -1,5 +1,5 @@ <script type="text/javascript"> - function autoPopulate_${parameters.name?html}(targetElement) { + function autoPopulate_${parameters.id?html}(targetElement) { <#if parameters.headerKey?exists && parameters.headerValue?exists> if (targetElement.options[targetElement.selectedIndex].value == '${parameters.headerKey?html}') { return; @@ -16,7 +16,7 @@ <#include "/${parameters.templateDir}/simple/text.ftl" /> <br/> <#if parameters.list?exists> -<select onChange="autoPopulate_${parameters.name?html}(this);"<#rt/> +<select onChange="autoPopulate_${parameters.id?html}(this);"<#rt/> <#if parameters.disabled?default(false)> disabled="disabled"<#rt/> </#if> Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ComboBoxTest.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ComboBoxTest.java?view=diff&rev=539115&r1=539114&r2=539115 ============================================================================== --- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ComboBoxTest.java (original) +++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ComboBoxTest.java Thu May 17 14:05:23 2007 @@ -72,6 +72,7 @@ tag.setPageContext(pageContext); tag.setLabel("mylabel"); tag.setName("foo"); + tag.setId("cb"); tag.setList("collection"); tag.doStartTag(); Modified: struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/ComboBox-1.txt URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/ComboBox-1.txt?view=diff&rev=539115&r1=539114&r2=539115 ============================================================================== --- struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/ComboBox-1.txt (original) +++ struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/ComboBox-1.txt Thu May 17 14:05:23 2007 @@ -1,13 +1,13 @@ <tr> - <td class="tdLabel"><label for="foo" class="label">mylabel:</label></td> + <td class="tdLabel"><label for="cb" class="label">mylabel:</label></td> <td> <script type="text/javascript"> - function autoPopulate_foo(targetElement) { + function autoPopulate_cb(targetElement) { targetElement.form.elements['foo'].value=targetElement.options[targetElement.selectedIndex].value; } </script> -<input type="text" name="foo" value="hello" id="foo"/><br/> -<select onChange="autoPopulate_foo(this);"> +<input type="text" name="foo" value="hello" id="cb"/><br/> +<select onChange="autoPopulate_cb(this);"> <option value="foo">foo</option> <option value="bar">bar</option> <option value="baz">baz</option>