[JBoss JIRA] (RF-12715) richfaces.js searchForComponentRootOrReturn doesn't recognize non-richfaces components
by Lukáš Fryč (JIRA)
[ https://issues.jboss.org/browse/RF-12715?page=com.atlassian.jira.plugin.s... ]
Lukáš Fryč edited comment on RF-12715 at 1/11/13 5:23 AM:
----------------------------------------------------------
Another option how to fix {{searchForComponentRootOrReturn}} would be following idea:
Each RichFaces component's subelements (potential behavior sources) has following form of IDs:
{code}
#{clientId}[a-zA-Z]
{code}
So we can check the parent only if behaviorSource has form:
{code}
#{parentId}[a-zA-Z]
{code}
and additionally it is RichFaces component (which we check using DOM attachment technique: {{RichFaces.$(...)}}).
Algorithm:
{code}
var sourceElementId, parentElementId;
if (parentElementId && sourceElementId.indexOf(parentElementId) == 0) { // otherwise parent element is definitely not JSF component
var suffix = sourceElementId.substring(pareintId.length); // extract suffix
var parent_is_subelement_of_jsf_component = suffix.match(/[a-zA-Z]/); // match suffix for basic characters
}
{code}
We can enforce the pattern {{[a-zA-Z]}} for element IDs for component's elements which acts as behavior sources (in fact, this is common practice now).
was (Author: lfryc):
Another option how to fix {{searchForComponentRootOrReturn}} would be following alghoritm searching through parents:
Check the parent only if behaviorSource has form
{code}
#{clientId}[a-zA-Z]
{code}
algorithm:
{code}
var sourceElementId, parentElementId;
if (parentElementId && sourceElementId.indexOf(parentElementId) == 0) { // otherwise parent element is definitely not JSF component
var suffix = sourceElementId.substring(pareintId.length); // extract suffix
var parent_is_subelement_of_jsf_component = suffix.match(/[a-zA-Z]/); // match suffix for basic characters
}
{code}
We can enforce the pattern {{[a-zA-Z]}} for element IDs for component's elements which acts as behavior sources (in fact, this is common practice now).
> richfaces.js searchForComponentRootOrReturn doesn't recognize non-richfaces components
> --------------------------------------------------------------------------------------
>
> Key: RF-12715
> URL: https://issues.jboss.org/browse/RF-12715
> Project: RichFaces
> Issue Type: Feature Request
> Security Level: Public(Everyone can see)
> Components: component-a4j-core
> Affects Versions: 4.3.0.CR1
> Reporter: Brian Leathem
> Assignee: Brian Leathem
> Priority: Blocker
> Labels: regression
> Fix For: 4.3.0.CR1
>
> Original Estimate: 1 hour
> Remaining Estimate: 1 hour
>
> The searchForComponentRootOrReturn function in richfaces.js was created to correct the source element of jsf events to jsf components. However the check of whether an element belongs to a component fails for non JSF components.
> A concrete example of this failure can be seen when an event generates from a nested _f:ajax_ tag.
--
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
11 years, 11 months
[JBoss JIRA] (RF-12715) richfaces.js searchForComponentRootOrReturn doesn't recognize non-richfaces components
by Lukáš Fryč (JIRA)
[ https://issues.jboss.org/browse/RF-12715?page=com.atlassian.jira.plugin.s... ]
Lukáš Fryč edited comment on RF-12715 at 1/11/13 5:24 AM:
----------------------------------------------------------
Another option how to fix {{searchForComponentRootOrReturn}} would be following idea:
Each RichFaces component's subelements (potential behavior sources) has following form of IDs:
{code}
#{clientId}[a-zA-Z]
{code}
So we can check that a parent (in the chain of ancestors of {{sourceElement}}) has following form of ID:
{code}
#{parentId}[a-zA-Z]
{code}
and additionally it is RichFaces component (which we check using DOM attachment technique: {{RichFaces.$(...)}}).
Algorithm:
{code}
var sourceElementId, parentElementId;
if (parentElementId && sourceElementId.indexOf(parentElementId) == 0) { // otherwise parent element is definitely not JSF component
var suffix = sourceElementId.substring(pareintId.length); // extract suffix
var parent_is_subelement_of_jsf_component = suffix.match(/[a-zA-Z]/); // match suffix for basic characters
}
{code}
We can enforce the pattern {{[a-zA-Z]}} for element IDs for component's elements which acts as behavior sources (in fact, this is common practice now).
was (Author: lfryc):
Another option how to fix {{searchForComponentRootOrReturn}} would be following idea:
Each RichFaces component's subelements (potential behavior sources) has following form of IDs:
{code}
#{clientId}[a-zA-Z]
{code}
So we can check the parent only if behaviorSource has form:
{code}
#{parentId}[a-zA-Z]
{code}
and additionally it is RichFaces component (which we check using DOM attachment technique: {{RichFaces.$(...)}}).
Algorithm:
{code}
var sourceElementId, parentElementId;
if (parentElementId && sourceElementId.indexOf(parentElementId) == 0) { // otherwise parent element is definitely not JSF component
var suffix = sourceElementId.substring(pareintId.length); // extract suffix
var parent_is_subelement_of_jsf_component = suffix.match(/[a-zA-Z]/); // match suffix for basic characters
}
{code}
We can enforce the pattern {{[a-zA-Z]}} for element IDs for component's elements which acts as behavior sources (in fact, this is common practice now).
> richfaces.js searchForComponentRootOrReturn doesn't recognize non-richfaces components
> --------------------------------------------------------------------------------------
>
> Key: RF-12715
> URL: https://issues.jboss.org/browse/RF-12715
> Project: RichFaces
> Issue Type: Feature Request
> Security Level: Public(Everyone can see)
> Components: component-a4j-core
> Affects Versions: 4.3.0.CR1
> Reporter: Brian Leathem
> Assignee: Brian Leathem
> Priority: Blocker
> Labels: regression
> Fix For: 4.3.0.CR1
>
> Original Estimate: 1 hour
> Remaining Estimate: 1 hour
>
> The searchForComponentRootOrReturn function in richfaces.js was created to correct the source element of jsf events to jsf components. However the check of whether an element belongs to a component fails for non JSF components.
> A concrete example of this failure can be seen when an event generates from a nested _f:ajax_ tag.
--
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
11 years, 11 months
[JBoss JIRA] (RF-12715) richfaces.js searchForComponentRootOrReturn doesn't recognize non-richfaces components
by Lukáš Fryč (JIRA)
[ https://issues.jboss.org/browse/RF-12715?page=com.atlassian.jira.plugin.s... ]
Lukáš Fryč commented on RF-12715:
---------------------------------
Another option how to fix {{searchForComponentRootOrReturn}} would be following alghoritm searching through parents:
Use this only if behaviorSource has form
{code}
#{clientId}[a-zA-Z]
{code}
algorithm:
{code}
var sourceElementId, parentElementId;
if (parentElementId && sourceElementId.indexOf(parentElementId) == 0) { // otherwise parent element is definitely not JSF component
var suffix = sourceElementId.substring(pareintId.length); // extract suffix
var parent_is_subelement_of_jsf_component = suffix.match(/[a-zA-Z]/); // match suffix for basic characters
}
{code}
We can enforce the pattern {{[a-zA-Z]}} for element IDs for component's elements which acts as behavior sources (in fact, this is common practice now).
> richfaces.js searchForComponentRootOrReturn doesn't recognize non-richfaces components
> --------------------------------------------------------------------------------------
>
> Key: RF-12715
> URL: https://issues.jboss.org/browse/RF-12715
> Project: RichFaces
> Issue Type: Feature Request
> Security Level: Public(Everyone can see)
> Components: component-a4j-core
> Affects Versions: 4.3.0.CR1
> Reporter: Brian Leathem
> Assignee: Brian Leathem
> Priority: Blocker
> Labels: regression
> Fix For: 4.3.0.CR1
>
> Original Estimate: 1 hour
> Remaining Estimate: 1 hour
>
> The searchForComponentRootOrReturn function in richfaces.js was created to correct the source element of jsf events to jsf components. However the check of whether an element belongs to a component fails for non JSF components.
> A concrete example of this failure can be seen when an event generates from a nested _f:ajax_ tag.
--
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
11 years, 11 months
[JBoss JIRA] (RF-12715) richfaces.js searchForComponentRootOrReturn doesn't recognize non-richfaces components
by Lukáš Fryč (JIRA)
[ https://issues.jboss.org/browse/RF-12715?page=com.atlassian.jira.plugin.s... ]
Lukáš Fryč edited comment on RF-12715 at 1/11/13 5:18 AM:
----------------------------------------------------------
Another option how to fix {{searchForComponentRootOrReturn}} would be following alghoritm searching through parents:
Check the parent only if behaviorSource has form
{code}
#{clientId}[a-zA-Z]
{code}
algorithm:
{code}
var sourceElementId, parentElementId;
if (parentElementId && sourceElementId.indexOf(parentElementId) == 0) { // otherwise parent element is definitely not JSF component
var suffix = sourceElementId.substring(pareintId.length); // extract suffix
var parent_is_subelement_of_jsf_component = suffix.match(/[a-zA-Z]/); // match suffix for basic characters
}
{code}
We can enforce the pattern {{[a-zA-Z]}} for element IDs for component's elements which acts as behavior sources (in fact, this is common practice now).
was (Author: lfryc):
Another option how to fix {{searchForComponentRootOrReturn}} would be following alghoritm searching through parents:
Use this only if behaviorSource has form
{code}
#{clientId}[a-zA-Z]
{code}
algorithm:
{code}
var sourceElementId, parentElementId;
if (parentElementId && sourceElementId.indexOf(parentElementId) == 0) { // otherwise parent element is definitely not JSF component
var suffix = sourceElementId.substring(pareintId.length); // extract suffix
var parent_is_subelement_of_jsf_component = suffix.match(/[a-zA-Z]/); // match suffix for basic characters
}
{code}
We can enforce the pattern {{[a-zA-Z]}} for element IDs for component's elements which acts as behavior sources (in fact, this is common practice now).
> richfaces.js searchForComponentRootOrReturn doesn't recognize non-richfaces components
> --------------------------------------------------------------------------------------
>
> Key: RF-12715
> URL: https://issues.jboss.org/browse/RF-12715
> Project: RichFaces
> Issue Type: Feature Request
> Security Level: Public(Everyone can see)
> Components: component-a4j-core
> Affects Versions: 4.3.0.CR1
> Reporter: Brian Leathem
> Assignee: Brian Leathem
> Priority: Blocker
> Labels: regression
> Fix For: 4.3.0.CR1
>
> Original Estimate: 1 hour
> Remaining Estimate: 1 hour
>
> The searchForComponentRootOrReturn function in richfaces.js was created to correct the source element of jsf events to jsf components. However the check of whether an element belongs to a component fails for non JSF components.
> A concrete example of this failure can be seen when an event generates from a nested _f:ajax_ tag.
--
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
11 years, 11 months
[JBoss JIRA] (RF-12145) RF4.2: Render and Oncomplete attributes not evaluated after invokeApplication if command is not rendered anymore
by Michael Heinen (JIRA)
[ https://issues.jboss.org/browse/RF-12145?page=com.atlassian.jira.plugin.s... ]
Michael Heinen reopened RF-12145:
---------------------------------
I tested my attached sample app with richfaces 4.3.0.20121214-M3 and it is still not working. Please have a look again and test carefully with the sample app.
There is also a workaround attached (see comment 08/Aug/12 4:05 AM) which shows the correct behavior.
> RF4.2: Render and Oncomplete attributes not evaluated after invokeApplication if command is not rendered anymore
> ----------------------------------------------------------------------------------------------------------------
>
> Key: RF-12145
> URL: https://issues.jboss.org/browse/RF-12145
> Project: RichFaces
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: component-a4j-core, core
> Affects Versions: 4.2.0.Final
> Environment: MyFaces 2.1.6 / Mojarra 2.1.7
> Tomcat 6.0.35 / 7.0.26
> Reporter: Michael Heinen
> Assignee: Lukáš Fryč
> Fix For: 4.3.0.M3
>
> Attachments: onc333.war, onc42.war, RF-12145.zip, zOnc333WithLibs.war, zOnc42New.war, zOnc42WithLibs.war
>
> Original Estimate: 3 hours
> Remaining Estimate: 3 hours
>
> Sample use case:
> The last page of a wizard contains a commandButton with an EL expressions in the oncomplete attribute and in the render attribute.
> This button renders an outer component in order to close the wizard. The button itself is not rendered anymore after clicking it.
> As a consequence the EL expressions of the oncomplete attribute and of the render attribute is not evaluated after the invocation of an actionListener.
> This worked well with richfaces 3.3.3, therefore it's a critical regression.
> I'll attach a sample webApp for richfaces 4.2 and for riochfaces 3.3.3
> Note that the render attribute of f:ajax is evaluated correctly.
> These attributes of the clicked command must be evaluated in phase render response in all cases.
> ----
> {code:title="OncController.java"}
> package com;
> import java.util.Map;
> import javax.faces.bean.ManagedBean;
> import javax.faces.bean.SessionScoped;
> import javax.faces.context.FacesContext;
> import javax.faces.event.ActionEvent;
> @ManagedBean(name = "OncController")
> @SessionScoped
> public class OncController
> {
> private boolean innerShown = true;
>
> private int calls = 0;
> public OncController()
> {
> }
> public boolean isInnerShown()
> {
> return innerShown;
> }
> public void setInnerShown(boolean aInnerShown)
> {
> innerShown = aInnerShown;
> }
>
> public void clear(final ActionEvent ae)
> {
> innerShown=true;
> calls=0;
> }
> public void doIt(final ActionEvent ae)
> {
> final Map<String, Object> requestMap = FacesContext.getCurrentInstance().getExternalContext()
> .getRequestMap();
> requestMap.put("key1", "alert('after actionListener');");
> requestMap.put("key2", "group2");
> calls++;
> }
> public String getOncomplete()
> {
> final Map<String, Object> requestMap = FacesContext.getCurrentInstance().getExternalContext()
> .getRequestMap();
> final String value = (String) requestMap.get("key1");
> if (value != null)
> {
> return value;
> }
> else
> {
> return "alert('before actionListener');";
> }
> }
> public String getRenderIdsRichfaces()
> {
> final Map<String, Object> requestMap = FacesContext.getCurrentInstance().getExternalContext()
> .getRequestMap();
> final String value = (String) requestMap.get("key2");
> if (value != null)
> {
> return ","+value;
> }
> return"";
> }
>
> public String getRenderIdsFAjax()
> {
> final Map<String, Object> requestMap = FacesContext.getCurrentInstance().getExternalContext()
> .getRequestMap();
> final String value = (String) requestMap.get("key2");
> if (value != null)
> {
> return " " + value;
> }
> return"";
> }
>
> public int getCalls()
> {
> return calls;
> }
> }
> {code}
> {code:title="oncomplete.xhtml"}
> <html 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"
> xmlns:c="http://java.sun.com/jsp/jstl/core">
> <ui:composition>
> <h:head><title>Oncomplete test</title></h:head>
> <h:body>
> <a4j:log mode="popup"/>
> <h:form id="myForm">
> Post button rendered:<h:selectBooleanCheckbox id="innerBool" value="#{OncController.innerShown}"/>
> <br/>
> <h:panelGroup id="outer">
> <c:if test="#{OncController.innerShown}">
> <a4j:commandButton value="RichFaces Post"
> actionListener="#{OncController.doIt}"
> render="outer,details#{OncController.renderIdsRichfaces}"
> oncomplete="#{OncController.oncomplete}"/>
> <h:commandButton value="fAJAX Post"
> actionListener="#{OncController.doIt}">
> <f:ajax render="outer details#{OncController.renderIdsFAjax}"
> execute="@form"/>
> </h:commandButton>
> </c:if>
> </h:panelGroup>
> <br/><br/>
> <h:panelGroup id="details">
> oncomplete: <h:outputText value="#{OncController.oncomplete}"/>
> </h:panelGroup>
> <br/><br/>
> <h:panelGroup id="group2">
> calls: <h:outputText value="#{OncController.calls}"/>
> </h:panelGroup>
> <br/><br/>
> <a4j:commandButton value="Clear"
> actionListener="#{OncController.clear}"
> render="myForm" />
> </h:form>
> </h:body>
> </ui:composition>
> </html>
> {code}
--
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
11 years, 11 months