Problems with Ajax requests within a a4j:repeat loop
----------------------------------------------------
Key: RF-1341
URL:
http://jira.jboss.com/jira/browse/RF-1341
Project: RichFaces
Issue Type: Bug
Affects Versions: 3.1.3
Environment: MyFaces, Richfaces 3.1.3 snapshot
Reporter: Peter Mahoney
I have come across two problems following a change to put some fields in an a4j:repeat
loop. The backing beans have not changed. This is the code:
<a4j:repeat id="termClauses"
value="#{collectionSearchHandler.termClauses}" var="clause">
<a4j:region id="vocabularyFilterRegion">
<h:selectOneMenu id="vocabularyFilter"
value="#{clause.vocabulary}">
<a4j:support id="vocabularyAjaxSupport" event="onchange"
reRender="termFilterPanel" ajaxSingle="true" />
<f:selectItem itemValue="#{collectionSearchHandler.blankVocabulary}"
itemLabel="#{msgs.quizFirstVocabularySelectItemDescription}" />
<f:selectItems
value="#{collectionSearchHandler.vocabularyFilterItems}" />
</h:selectOneMenu>
<a4j:status startText="#{msgs.quizTermSearchInProgressMessage}"
/>
</a4j:region>
<a4j:region id="termFilterRegion">
<a4j:outputPanel id="termFilterPanel">
<h:panelGroup rendered="#{clause.hasVocabulary}">
<ul style="list-style-type:none; margin:0px;">
<a4j:repeat id="termFilters"
value="#{clause.termFilters}" var="termFilter"
rowKeyVar="idx">
<li>
<h:selectOneMenu id="termFilter"
value="#{termFilter.term}" converter="com.dbplc.quiz.Term"
style="width:100%">
<a4j:support id="termAjaxSupport" event="onchange"
reRender="termFilterPanel,qbankSearchResultsPanel" ajaxSingle="true"
actionListener="#{collectionSearchHandler.searchPerformed}" />
<f:selectItem itemValue="#{collectionSearchHandler.blankTerm}"
itemLabel="#{msgs.quizFirstTermSelectItemDescription}" />
<f:selectItems value="#{clause.termFilterItemMap[idx]}" />
</h:selectOneMenu>
<h:commandButton
actionListener="#{collectionSearchHandler.searchPerformed}" />
</li>
</a4j:repeat>
</ul>
</h:panelGroup>
</a4j:outputPanel>
<rich:messages />
</a4j:region>
</a4j:repeat>
Firstly I get the following error when the form is submitted by changing the
"VocabularyFilter" value:
/questionsearch.xhtml @25,77 value="#{clause.vocabulary}": Target Unreachable,
identifier 'clause' resolved to null
If I add an onchange="this.form.submit()" to the field, to bypass the Ajax, it
works fine.
So, with the above workaround, I then get the problem that the
collectionSearchHandler.searchPerformed() method (referenced by the a4j:support tag) is
only called every second form submit. This worked without problems before adding the outer
a4j:repeat. Using the commandButton to submit the form works every time.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira