<a4j:region> and the "process" attribute
----------------------------------------

                 Key: RF-11364
                 URL: https://issues.jboss.org/browse/RF-11364
             Project: RichFaces
          Issue Type: Bug
      Security Level: Public (Everyone can see)
    Affects Versions: 3.3.3.Final
            Reporter: Nicholas Oxhøj


Hi,

It seems to me that the <a4j:region> doesn't work correctly together withe the 
process="..." attribute on AJAX commands. Specifically you cannot process 
inputs outside the <a4j:region> even though you list them specifically in the 
process attribute.

I have always thought that ajaxSingle and <a4j:region> were two functionally 
equivalent ways of specifying which inputs should be processed in the first 
phases of the JSF lifecycle - one is easy to use if you only want to process a 
single input and the other if you have a group of related inputs.

In chapter [5.7.4. "Decide what to 
process"|http://docs.jboss.org/richfaces/latest_3_3_X/en/devguide/html/ArchitectureOverview.html#process]
 of the Richfaces 3.3.X documentation, it is stated that: The "_process_" 
attribute allows to define the ids of components to be processed together with 
the component which is marked as ajaxSingle *+or wrapped to region+*.

As I understand this, the example in the documentation:

{code:xml}
<h:inputText value="#{bean.name}" id="name">
    <a4j:support ajaxSingle="true" process="email" event="onblur" 
reRender="someOut"/>
</h:inputText>
<h:inputTextarea value="#{bean.description}" id="desc" />
<h:inputText value="#{bean.email}" id="email">
    <a4j:support ajaxSingle="true" process="name" event="onblur" 
reRender="someOut"/>
</h:inputText>
{code}

should be functionally equivalent to the following code:

{code:xml}
<a4j:region>
    <h:inputText value="#{bean.name}" id="name">
        <a4j:support process="email" event="onblur" reRender="someOut"/>
   </h:inputText>
</a4j:region>
<h:inputTextarea value="#{bean.description}" id="desc" />
<h:inputText value="#{bean.email}" id="email">
   <a4j:support ajaxSingle="true" process="name" event="onblur" 
reRender="someOut"/>
/h:inputText>
{code}

But this doesn't work as expected. The "email" component is no longer processed 
when focus leaves the "name" component.

The reason for this is found in the class UIAjaxRegion, where all the 
"processing methods" (processDecodes, processValidators, and processUpdates) 
contains code similar to the following:

{code}
if (ajaxContext.isAjaxRequest() && null != ajaxSingleClientId) {
    invokeOnComponent(context, ajaxSingleClientId, new 
ContextCallbackWrapper(updateCallback));
    Set<String> areasToProcess = ajaxContext.getAjaxAreasToProcess();
    if(null != areasToProcess){
        for (String areaId : areasToProcess) {
            invokeOnComponent(context, areaId, new 
ContextCallbackWrapper(updateCallback));
        }
    }
} else {
    super.processUpdates(context);
}
{code}

So the value of the process attribute (retrieved through 
ajaxContext.getAjaxAreasToProcess), is only used if the AJAX command has 
ajaxSingle="true". I don't understand why the "process" attribute isn't used, 
regardless of the value of the ajaxSingle attribute???

Looking at the code, I thought that a workaround would the be to just add 
ajaxSingle="true" to the <a4j:support> so that it would again look like:

{code:xml}
<a4j:support ajaxSingle="true" process="email" event="onblur" 
reRender="someOut"/>
{code}

But this doesn't work either. Although the code above _will_ now enter the 
first branch and therefore loop through the areaIds specified in the process 
attribute, it will only find them if they are located inside the <a4j:region> 
itself, since the invokeOnComponent() is implicitely called on the  
UIAjaxRegion.

Regards,

Nicholas Oxhøj

--
This message is automatically generated by JIRA.
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