[ 
https://issues.jboss.org/browse/RF-11365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12640577#comment-12640577
 ] 

Sverker Abrahamsson commented on RF-11365:
------------------------------------------

Hi again
I've found that if oncomplete is used on a component which is in a popup panel 
then it does not work. It doesn't matter if the above solution is applied or 
not, nor does it matter if it is a portlet environment or deployed as normal 
web application. I belive though that it is closely related to the issue in 
this report so I file it here rather than creating a new report.

Below is my test fragment:

{code}
                        <a4j:commandButton action="#{testBean.test}" 
value="Open popup after ajax completed" 
oncomplete="#{rich:component('popup')}.show();}"/> 
                        <rich:popupPanel id="popup" modal="true" 
resizeable="true">
                                <f:facet name="header">
                                        <h:outputText value="Simple popup 
panel" />
                                </f:facet>
                                <f:facet name="controls">
                                        <h:outputLink value="#" 
onclick="#{rich:component('popup')}.hide(); return false;">X</h:outputLink>
                                </f:facet>
                                <p>Modal popup panel</p>
                                <a4j:commandButton action="#{testBean.test}" 
value="Close popup after ajax completed" 
oncomplete="#{rich:component('popup')}.hide();}"/> 
                        </rich:popupPanel>
{code}

                
> onbeforedomupdate and oncomplete not working in Portlet environment
> -------------------------------------------------------------------
>
>                 Key: RF-11365
>                 URL: https://issues.jboss.org/browse/RF-11365
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 4.0.0.Final
>            Reporter: Detlef Pleiss
>             Fix For: 4.Future
>
>
> example page:
> {code}
> <ui:composition xmlns="http://www.w3.org/1999/xhtml";
>       xmlns:ui="http://java.sun.com/jsf/facelets";
>       xmlns:h="http://java.sun.com/jsf/html";
>       xmlns:f="http://java.sun.com/jsf/core";
>       xmlns:a4j="http://richfaces.org/a4j";
>       xmlns:rich="http://richfaces.org/rich";>
> <h:head/>
> <h:form>
>     <h:panelGrid columns="2">
>        <h:outputText value="Text:" />
>        <h:inputText value="#{echoBean.text}" >
>           <a4j:ajax event="keyup" 
>                 
>                                       onbeforesubmit="alert('beforesubmit')"
>                                       onbegin="alert('begin')"
>                                       
> onbeforedomupdate="alert('beforedomupdate')"
>                                       oncomplete="alert('complete')"
>                                       
>                 render="text,count" listener="#{echoBean.countListener}"/>
>          </h:inputText>
>       <h:outputText value="Echo:" />
>       <h:outputText id="text" value="#{echoBean.text}" />
>     <h:outputText value="Count:" />
>     <h:outputText id="count" value="#{echoBean.count}" />
>    </h:panelGrid>
> </h:form>
> </ui:composition>
> {code}
> The alerts for onbeforedomupdate and oncomplete do not appear in a portal 
> environment; they do in a non-portal web environment. 
> The Ajax XML response in a non portal web environment contains the tag 
> <extension id="org.richfaces.extension"> with the Javascript code from the 
> named attributes.
> But, in a portal environment the id gets prefixed like i.e. <extension 
> id="A3331org.richfaces.extension">
> In fact Richfaces asks for this prefix in 
> richfaces-core-api-4.0.0.Final-sources : 
> org.richfaces.renderkit.util.CoreAjaxRendererUtils.java
> line 96 by calling 
> facesContext.getExternalContext().encodeNamespace(EXTENSION_ID))
> In a Servlet environment this leaves EXTENSION_ID = "org.richfaces.extension" 
> unchanged, but in a Portlet environment its function is to
> "Return the specified name, after prefixing it with a namespace that ensures 
> that it will be unique within the context of a particular page" (quoted from 
> Javadoc).
> Only, the Javascript meant to react on the extension tag is hardcoded to 
> react on the ID "org.richfaces.extension" only without any prefix:
> META-INF/resources/richfaces.js line 333 :
> {code}
>       var getExtensionResponseElement = function(responseXML) {
>               return jQuery("partial-response 
> extension#org\\.richfaces\\.extension", responseXML);
>       };
> {code}
> So, in a Portlet environment the partial-response/extension is ignored due to 
> the prefixed ID.
> A possible solution might be to have the Javascript accept any prefix in 
> front of the ID, like:
> {code}
>       var getExtensionResponseElement = function(responseXML) {
>               return jQuery("partial-response 
> extension[id$='org\\.richfaces\\.extension']", responseXML);
>       };
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
richfaces-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/richfaces-issues

Reply via email to