1

My form contains a dropdown list inside a ui:repeat component. When any list item is selected, an f:ajax call triggers a refresh of both dropdown list and several other components inside ui:repeat . Im struggling to work out the correct id format for the f:ajax render="???????" (see facelet view below). Any help would be appreciated.

Ive supplied raw source view of the rendered screen (actual JSF ids) and a facelet view showing the same components as coded.

Browser Source View

<form id="GeneralMedicalHistory" name="GeneralMedicalHistory" method="post" action="..." 

<span id="GeneralMedicalHistory:GeneralMedicalHistory_P"> 

<span id="GeneralMedicalHistory:medhist">

   <table border="0" class="table_form">

   <select id="GeneralMedicalHistory:RPTK:0:MedicalCondition" name="GeneralMedicalHistory:RPTK:0:MedicalCondition" >  ---> TARGET ID  (UI:REPEAT)

Facelet view

<h:form id ="GeneralMedicalHistory">
<h:panelGroup id="GeneralMedicalHistory_P">
<h:panelGroup id="medhist">
<ui:repeat value="#{f.repeatingItemGroups['MedicalHistory'][1]}" var="repeatKey" id="RPTK" >      
<h:commandLink action="remove_repeating_ig" rendered="${f.items[removeOid].isNew and repeatKey != '1'}"></>
<table border="0" class="table_form"> 
 <h:selectOneMenu value="${f.items[oid].value}" id="MedicalCondition" >  
   <f:selectItems value="${f.items[oid].codeListItems}"/>
   <f:ajax render="?????????" event="click" listener="#{f.clearModelValuesViaAjax}"  /> 
 </h:selectOneMenu>
</table>
</h:panelGroup>     
</h:panelGroup>      
</h:form>

Ive tried the following but none have worked...

  1. f:ajax render="GeneralMedicalHistory:RPTK:0:MedicalCondition"
  2. f:ajax render=":GeneralMedicalHistory:RPTK:0:MedicalCondition"
  3. f:ajax render="GeneralMedicalHistory_P:medhist:RPTK:0:MedicalCondition"
  4. f:ajax render=":GeneralMedicalHistory_P:medhist:RPTK:0:MedicalCondition"
  5. f:ajax render="GeneralMedicalHistory:GeneralMedicalHistory_P:medhist:RPTK:0:MedicalCondition"
  6. f:ajax render=":GeneralMedicalHistory:GeneralMedicalHistory_P:medhist:RPTK:0:MedicalCondition"
Steve Tee
  • 13
  • 3

1 Answers1

2

The <ui:repeat> is by itself a NamingContainer. You can just reference a client ID relative to the <ui:repeat> itself.

Your code example is confusing, you're basically attempting to perform render="@this", so here's a different and more elaborate example wherein another menu component and some input component are been ajax-updated on change of the current menu:

<ui:repeat ...>
    <h:selectOneMenu ...>
        ...
        <f:ajax ... render="otherMenu someInput" />
    </h:selectOneMenu>
    <h:selectOneMenu id="otherMenu" ... />
    <h:inputText id="someInput" ... />
</ui:repeat>

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • My render list does contain more than @this so ur example is closer to reality.Ta. Source tree ids above include refs. to all preceding containers e.g GeneralMedicalHistory:RPTK or GeneralMedicalHistory:medhist:RPTK + a repeat key value (0,1,2 etc) + a component id e.g. MedicalCondition. All preceding naming containers are present in a pot. target id a/c to view source. In 99% of my other ajax cases, I specify formid:componentid - the form is the container AND render id reflects it. In the current case, the render id should not include a container id, only the component id. Is this correct ? – Steve Tee May 03 '13 at 12:00
  • If it's inside the **same** naming container, yes. Naming containers are ``, ``, ``, etc. – BalusC May 03 '13 at 12:02