I have a selectOneRadio with the choices "Voice" and "Data".
Then I have a selectOneMenu with the item "no data option" for both and then other items, which depends on the chosen radio button.
So, if I choose Voice I have in the dropdown "no data option", "Office", "Office premium" and "Office premium plus", while if I choose Data I have "no data option", "Data start", "Data medum" and "Data premium".
I solved the automatic dropdown content change with f:ajax and it works well.
Now, if in the dropdown "no data option" is selected a warning(small text near the dropdown) should appear.
So I defined an outputLabel and set the value depending of the value of the selected item in the dropdown.
All works fine until I change the choice in the radio button. for example: - the page loads and "Voice" and "no data option" are per default selected and the warning label is shown. - I select "Office" in the dropdown and the warning disappears - I then select "Data"; the dropdown refreshes with the new items and "no data option" is selected BUT the warning doesn't appear.
If I select another item in the dropdown and then come back to "no data option" it appears; It is just when I switch from "Voice" to "Data" (and vice versa) that for some reason the rendering doesn't work as I expect...
Here is my code; first the radio button with the correspondig ajax for rendering the dropdown and then the dropdown with the corresponding ajax for rendering the warning label and at the end the label, where its value depends on the selected item in the dropdown.
I hope I described the problem clear enough. If not, just ask and I'll try to be more precise :)
<h:selectOneRadio id="subscriptionType" value="#{detailModel.afterObject.subscriptionType}">
<f:selectItems value="#{detailModel.subscriptionTypeValues}" />
<f:ajax execute="@this" render="dataOptions" />
</h:selectOneRadio>
<h:selectOneMenu id="dataOptions" value="#{detailModel.dataOption}">
<f:selectItems value="#{detailModel.dataOptionsBySubscriptionType}" var="sdo" itemLabel="#{sdo.dataOptionName}" itemValue="#{sdo}"/>
<f:converter converterId="ch.ethz.id.cmn.DataOptionConverter" />
<f:ajax execute="@this" render="noDataOptionChoosenLabel" />
</h:selectOneMenu>
<h:outputLabel id="noDataOptionChoosenLabel"
value="#{ (detailModel.dataOption == null or detailModel.dataOption.dataOptionName == detailModel.noDataOption) ? msg.subscriptionFormNoDataOptionChoosen : ''}"
style="font-style: italic; font-size:9px; color:red;"/>