[
https://issues.apache.org/jira/browse/MYFACES-3696?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13615882#comment-13615882
]
Leonardo Uribe commented on MYFACES-3696:
-----------------------------------------
The bug is on org.apache.myfaces.shared.renderkit.html.util.ResourceUtils . The
check is done on renderMyfacesJSInlineIfNecessary() but using
facesContext.getPartialViewContext().isPartialRequest(), and not using
facesContext.getPartialViewContext().isAjaxRequest() . In
renderDefaultJsfJsInlineIfNecessary(), isAjaxRequest() is used. The right thing
to do is check both isPartialRequest() or isAjaxRequest() . MyFaces code has an
alternative by backward compatibility that render the submit script inline, so
we should not do the check in that location.
> Button rendering itself after ajax request loses type and other attributes
> --------------------------------------------------------------------------
>
> Key: MYFACES-3696
> URL: https://issues.apache.org/jira/browse/MYFACES-3696
> Project: MyFaces Core
> Issue Type: Bug
> Affects Versions: 2.1.10
> Reporter: dennis hoersch
>
> The renderer for command buttons and command links inserts a special form
> submit script inline before the first button (or link) on a page is rendered
> by calling
> 'org.apache.myfaces.shared.renderkit.html.HtmlJavaScriptUtils.renderFormSubmitScript(FacesContext)'
> I have a CommandButton with ajax behavior that renders also itself like this:
> <h:form id="testForm">
> <h:commandButton
> value="do somethings">
> <f:ajax execute="@this" render="@this" />
> </h:commandButton>
> </h:form>
> After the ajax request is done and the markup is replaced by the Javascript
> function _Dom.outerHtml() the html in the browser ends up with this:
> <input
> type="text/javascript"
> onclick="...submit code ..."
> value="" />
> and is not a 'button' anymore (Firefox renders it as text input field).
> The cause is that the update response for the button contains as first
> element the inline script code.
> Is it necessary to render the inline script on ajax requests?
> Changing HtmlJavaScriptUtils to insert it only on non-ajax request the
> example above works as expected at the first glance.
> HtmlJavaScriptUtils.java
> public static void renderFormSubmitScript(FacesContext facesContext)
> throws IOException
> {
> if (facesContext.getPartialViewContext().isAjaxRequest())
> {
> return;
> }
> ...
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira