You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2011/09/30 17:48:57 UTC
svn commit: r1177707 -
/myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java
Author: lu4242
Date: Fri Sep 30 15:48:57 2011
New Revision: 1177707
URL: http://svn.apache.org/viewvc?rev=1177707&view=rev
Log:
MYFACES-3340 h:commandButton with f:ajax behavior and f:param renders submit script
Modified:
myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java
Modified: myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java?rev=1177707&r1=1177706&r2=1177707&view=diff
==============================================================================
--- myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java (original)
+++ myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java Fri Sep 30 15:48:57 2011
@@ -333,12 +333,18 @@ public class HtmlButtonRendererBase
if (nestedFormInfo != null)
{
- if (validParams != null && !validParams.isEmpty() )
- {
- rendererOnClick.append(buildServerOnclick(facesContext, uiComponent, uiComponent.getClientId(facesContext), nestedFormInfo, validParams));
- }
- else
- {
+ // There is no clean way to detect if a "submit" behavior has been added to the component,
+ // so to keep things simple, if the button is submit type, it is responsibility of the
+ // developer to add a client behavior that submit the form, for example using a f:ajax tag.
+ // Otherwise, there will be a situation where a full submit could be trigger after an ajax
+ // operation. Note we still need to append two scripts if necessary: autoscroll and clear
+ // hidden fields, because this code is called for a submit button.
+ //if (behaviors.isEmpty() && validParams != null && !validParams.isEmpty() )
+ //{
+ // rendererOnClick.append(buildServerOnclick(facesContext, uiComponent, uiComponent.getClientId(facesContext), nestedFormInfo, validParams));
+ //}
+ //else
+ //{
String formName = nestedFormInfo.getFormName();
if (JavascriptUtils.isRenderClearJavascriptOnButton(facesContext.getExternalContext())) {
//call the script to clear the form (clearFormHiddenParams_<formName>) method
@@ -348,7 +354,7 @@ public class HtmlButtonRendererBase
if (MyfacesConfig.getCurrentInstance(facesContext.getExternalContext()).isAutoScroll()) {
HtmlRendererUtils.appendAutoScrollAssignment(rendererOnClick, formName);
}
- }
+ //}
}
//according to the specification in jsf.util.chain jdocs and the spec document we have to use