0

I have a set of 3 radio buttons (A, B, and C). Like, A="1", B="2", and C="other value". When I select C, user can write a value of is choice.

The problem is: if the user writes a value on the box, and then changes to A or B, if he chooses C, the value will still be there, and I want the value in C be cleaned.

How can I accomplish this?

Here is my jsf code :

<p:selectOneRadio required="true" id="radio" value="#{backBean. SelectedAmountOption}" layout="custom">
    <f:selectItem itemLabel="#{msgs['combo.box.charge.amount.1']}" itemValue="1" />
    <f:selectItem itemLabel="#{msgs['combo.box.charge.amount.2']}" itemValue="2" />
    <f:selectItem itemLabel="#{msgs['combo.box.charge.amount.3']}" itemValue="3" />

<h:panelGrid columns="3" cellpadding="5">
    <p:radioButton id="A " for="Aa" itemIndex="0"/>
    <p:outputLabel value="#{msgs['combo.box.charge.amount.1']}" for="Aa"/>
    <p:spacer/>

    <p:radioButton id="B" for="Bb" itemIndex="1"/>
    <p:outputLabel value="#{msgs['combo.box.charge.amount.2']}" for=" Bb "/>
    <p:spacer/>
<p:radioButton  id="C" for="Cc" itemIndex="2" />
<pe:inputNumber
                styleClass=" Cc "
                placeholder="#{msgs['combo.box.charge.amount.3']}"
                value="#{backBean.e xplicitAmount}>
</pe:inputNumber>
TDG
  • 5,909
  • 3
  • 30
  • 51
mahdieh
  • 156
  • 3
  • 13
  • I don't see any attempt to clear it either via javascript or via serverside (ajax)... The second one is a plain full jsf ajax thing, the first one a not to complex (rather basic) javascript/jquery one. Both of which have many examples on the internet. Please searchs the internet for the more 'generic' question lilke "how to update a value of another control when using jsf" and add either ajax or javascript/jquery to that. – Kukeltje May 14 '16 at 08:16
  • Your `for` is just plain wrong. Check PrimeFaces documentation. – BalusC May 14 '16 at 09:25

0 Answers0