I'm using an p:selectOneRadio
with p:ajax
and the value of another component (p:inputText
), not binding its value in my bean.
If I use p:selectBooleanCheckbox
instead the behavior is exactly what I need, update the bean before calling the method in ajax. Is this a bug in p:selectOneRadio
or is this its default behavior?
I'm using JSF2, PrimeFaces 4
The xhtml code:
<p:selectOneRadio id="enumId" value="#{xyzController.entity.enumValor}"
disabled="#{disabled}" required="true" plain="true">
<f:selectItems value="#{xyzController.enum}" var="item"
itemLabel="#{messages[ELUtils.evaluateExpression(itemLabelEL)]}"
itemValue="#{item}" />
<p:ajax event="change" listener="#{xyzController.aoTrocar}"
update="panelDominioFields" process="@form" />
</p:selectOneRadio>
<p:outputPanel layout="inline" id="panelDominioFields">
<p:inputText id="valorId"
value="#{xyzController.entity.valorNumericoValido}"
rendered="#{xyzController.mostrarCampoDominioNumerico}"
required="true">
<f:convertNumber type="number" locale="#{localeController.locale}"
currencyCode="#{localeController.currencyCode}" />
</p:inputText>
</p:outputPanel>
Get rid of
event="change"
, it's the wrong event. It defaults toclick
and is the right one already.Radio button values never change. They're only selected by click. In turn, selected values are submitted, but unselected values not.