myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo Uribe (JIRA)" <...@myfaces.apache.org>
Subject [jira] [Commented] (MYFACES-3696) Button rendering itself after ajax request loses type and other attributes
Date Tue, 19 Feb 2013 03:03:13 GMT

    [ https://issues.apache.org/jira/browse/MYFACES-3696?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13580977#comment-13580977
] 

Leonardo Uribe commented on MYFACES-3696:
-----------------------------------------

I was not able to reproduce the issue, but checking the code and the underlying logic, I think
it is valid to add that check. After all, once the page is loaded, the script remains in memory
no matter if the script node is removed (for example if there is an ajax operation over a
parent component like the form).

Let me think about it a little bit, and I'll commit the necessary changes.
                
> 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

Mime
View raw message