Author: musachy
Date: Mon Mar 16 20:09:51 2009
New Revision: 754994

URL: http://svn.apache.org/viewvc?rev=754994&view=rev
Log:
WW-3033 This change rollsback WW-2351. The id should not be change (it break 
backward compatibility and it is not a good idea), instead the name of the 
generated function is the one that should be changed

Modified:
    
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/UIBean.java
    
struts/struts2/trunk/core/src/main/resources/template/xhtml/form-close-validate.ftl
    
struts/struts2/trunk/core/src/main/resources/template/xhtml/form-validate.ftl
    
struts/struts2/trunk/core/src/test/java/org/apache/struts2/components/UIBeanTest.java
    
struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Radio-6.txt

Modified: 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/UIBean.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/UIBean.java?rev=754994&r1=754993&r2=754994&view=diff
==============================================================================
--- 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/UIBean.java
 (original)
+++ 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/components/UIBean.java
 Mon Mar 16 20:09:51 2009
@@ -859,7 +859,7 @@
        protected String escape(String name) {
         // escape any possible values that can make the ID painful to work 
with in JavaScript
         if (name != null) {
-            return name.replaceAll("[^a-zA-Z0-9_]", "_");
+            return name.replaceAll("[\\/\\.\\[\\]]", "_");
         } else {
             return "";
         }

Modified: 
struts/struts2/trunk/core/src/main/resources/template/xhtml/form-close-validate.ftl
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/xhtml/form-close-validate.ftl?rev=754994&r1=754993&r2=754994&view=diff
==============================================================================
--- 
struts/struts2/trunk/core/src/main/resources/template/xhtml/form-close-validate.ftl
 (original)
+++ 
struts/struts2/trunk/core/src/main/resources/template/xhtml/form-close-validate.ftl
 Mon Mar 16 20:09:51 2009
@@ -35,7 +35,7 @@
 -->
 <#if ((parameters.validate?default(false) == true) && 
(parameters.performValidation?default(false) == true))>
 <script type="text/javascript">
-    function validateForm_${parameters.id}() {
+    function validateForm_${parameters.id?replace('[^a-zA-Z0-9_]', '_', 
'r')}() {
         form = document.getElementById("${parameters.id}");
         clearErrorMessages(form);
         clearErrorLabels(form);

Modified: 
struts/struts2/trunk/core/src/main/resources/template/xhtml/form-validate.ftl
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/template/xhtml/form-validate.ftl?rev=754994&r1=754993&r2=754994&view=diff
==============================================================================
--- 
struts/struts2/trunk/core/src/main/resources/template/xhtml/form-validate.ftl 
(original)
+++ 
struts/struts2/trunk/core/src/main/resources/template/xhtml/form-validate.ftl 
Mon Mar 16 20:09:51 2009
@@ -24,8 +24,8 @@
        <script type="text/javascript" 
src="${base}/struts/xhtml/validation.js"></script>
        <script type="text/javascript" src="${base}/struts/utils.js"></script>
        <#if parameters.onsubmit??>
-               ${tag.addParameter('onsubmit', "${parameters.onsubmit}; return 
validateForm_${parameters.id}();")}
+               ${tag.addParameter('onsubmit', "${parameters.onsubmit}; return 
validateForm_${parameters.id?replace('[^a-zA-Z0-9_]', '_', 'r')}();")}
        <#else>
-               ${tag.addParameter('onsubmit', "return 
validateForm_${parameters.id}();")}
+               ${tag.addParameter('onsubmit', "return 
validateForm_${parameters.id?replace('[^a-zA-Z0-9_]', '_', 'r')}();")}
        </#if>
 </#if>

Modified: 
struts/struts2/trunk/core/src/test/java/org/apache/struts2/components/UIBeanTest.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/components/UIBeanTest.java?rev=754994&r1=754993&r2=754994&view=diff
==============================================================================
--- 
struts/struts2/trunk/core/src/test/java/org/apache/struts2/components/UIBeanTest.java
 (original)
+++ 
struts/struts2/trunk/core/src/test/java/org/apache/struts2/components/UIBeanTest.java
 Mon Mar 16 20:09:51 2009
@@ -98,8 +98,8 @@
         assertEquals(bean.escape("hello[world"), "hello_world");
         assertEquals(bean.escape("hello.world"), "hello_world");
         assertEquals(bean.escape("hello]world"), "hello_world");
-        assertEquals(bean.escape("hello!world"), "hello_world");
-        assertEquals(bean.escape("hel...@#$%^&*()world"), 
"hello__________world");
+        assertEquals(bean.escape("hello!world"), "hello!world");
+        assertEquals(bean.escape("hel...@#$%^&*()world"), 
"hel...@#$%^&*()world");
     }
 
     public void testEscapeId() throws Exception {

Modified: 
struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Radio-6.txt
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Radio-6.txt?rev=754994&r1=754993&r2=754994&view=diff
==============================================================================
--- 
struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Radio-6.txt
 (original)
+++ 
struts/struts2/trunk/core/src/test/resources/org/apache/struts2/views/jsp/ui/Radio-6.txt
 Mon Mar 16 20:09:51 2009
@@ -1,11 +1,11 @@
 <tr>
     <td class="tdLabel"></td>
     <td>
-        <input type="radio" name="myMap['name']" id="myMap__name__"value=""/>
-        <label for="myMap__name__">N/A</label>
-        <input type="radio" name="myMap['name']" id="myMap__name__Opt." 
value="Opt."/>
-        <label for="myMap__name__Opt.">Opt.</label>
-        <input type="radio" name="myMap['name']" id="myMap__name__Std." 
checked="checked" value="Std."/>
-        <label for="myMap__name__Std.">Std.</label>
+        <input type="radio" name="myMap['name']" id="myMap_'name'_"value=""/>
+        <label for="myMap_'name'_">N/A</label>
+        <input type="radio" name="myMap['name']" id="myMap_'name'_Opt." 
value="Opt."/>
+        <label for="myMap_'name'_Opt.">Opt.</label>
+        <input type="radio" name="myMap['name']" id="myMap_'name'_Std." 
checked="checked" value="Std."/>
+        <label for="myMap_'name'_Std.">Std.</label>
     </td>
 </tr>


Reply via email to