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

dennis hoersch commented on MYFACES-3696:
-----------------------------------------

Which classes are involved in the solution?

If I use (only) the updated 
org.apache.myfaces.shared.renderkit.html.util.ResourceUtils I have still the 
described behavior. The FormSubmitScript is still included in the ajax response.

The call that renders the submit script 
(HtmlRendererUtils.renderFormSubmitScript() (delegating to 
'HtmlJavaScriptUtils')) is some lines below the 
'ResourceUtils.renderDefaultJsfJsInlineIfNecessary() in 
'HtmlButtonRendererBase.encodeEnd()'.

Maybe I don't understand the last sentence in your response correctly. Why 
should the submit script be included in ajax responses?

(Regardless: If I understand the JavaDoc (and implementation) of 
PartialViewContext.isPartialRequest() right it includes already the check for 
an ajax request?)
                
> 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
>            Assignee: Leonardo Uribe
>             Fix For: 2.0.17, 2.1.11
>
>
> 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

Reply via email to