Author: nbelaevski
Date: 2007-07-27 18:41:06 -0400 (Fri, 27 Jul 2007)
New Revision: 313
Modified:
trunk/framework/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java
Log:
Requested fix for
http://jira.jboss.com/jira/browse/RF-476 backported from 3.1.0
Modified: trunk/framework/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java
===================================================================
---
trunk/framework/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java 2007-07-25
15:07:03 UTC (rev 312)
+++
trunk/framework/src/main/java/org/ajax4jsf/renderkit/html/AjaxFormRenderer.java 2007-07-27
22:41:06 UTC (rev 313)
@@ -304,8 +304,20 @@
getValidJavascriptName(formName));
script.append("(){").append(functionName).append("();}\n");
// MyFaces 1.1.5 clear form function name
- script.append("function
").append("clearFormHiddenParams_").append(
- formName.replace("-", "$_").replace(':', '_'));
+
+ //equivalent for formName.replace("-", "$_")
+ StringBuffer formNameReplaceBuffer = new StringBuffer(formName.length());
+ int idx = -1;
+ int idxA = 0;
+ while ((idx = formName.indexOf('-', idxA)) != -1) {
+ formNameReplaceBuffer.append(formName.substring(idxA, idx));
+ formNameReplaceBuffer.append("$_");
+ idxA = idx + 1;
+ }
+ formNameReplaceBuffer.append(formName.substring(idxA));
+
+ script.append("function
").append("clearFormHiddenParams_").append(formNameReplaceBuffer.toString().
+ replace(':', '_'));
script.append("(){").append(functionName).append("();}\n");
// Just to be sure we call this clear method on each load.
// Otherwise in the case, that someone submits a form by pressing Enter