You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "dennis hoersch (JIRA)" <de...@myfaces.apache.org> on 2013/02/18 15:53:13 UTC

[jira] [Created] (MYFACES-3696) Button rendering itself after ajax request loses type and other attributes

dennis hoersch created MYFACES-3696:
---------------------------------------

             Summary: 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