I have an existing form that has a radio select button. What I wanted is, whenever the user makes a choice of selecting any one value, either an input text box or a hyperlink should be displayed on the same form.
I think I am on the right track of using ajax to do this. However, I came up with the below code, but it is not updating the form on selecting any of the radio value:
Note: I am showing only what should happen on selecting only one of the value in the radio to keep things little clean.
<tr>
<td><ice:outputLabel value="Agenda Type" styleClass="mandatory"/></td>
<td>
<h:selectOneRadio id="agenda_type" action="#{eventManagementController.radioVal}" required="true" label="Action">
<f:selectItem itemValue="standard" itemLabel="Standard"/>
<f:selectItem itemValue="normal" itemLabel="Normal"/>
<f:ajax process="console" event="click" update="display" />
</h:selectOneRadio>
</td>
<td>
<ice:message for="agenda_type" errorClass="error"/>
</td>
</tr>
<tr>
<td>
<ice:outputLabel value="Standard Agenda" rendered="#{eventManagementController.radioVal eq 'standard'}"/>
</td>
<td>
<h:commandLink id="display" immediate="true" rendered="#{eventManagementController.radioVal eq 'standard'}"
action="#{eventManagementController.goToAgendaDetailsPage}" value="Enter Details">
</h:commandLink>
<br/>
</td>
</tr>
There are controllers defined to store the value of the radioVal as:
public String getRadioVal() {
return radioVal;
}
public void setRadioVal(String radioVal) {
this.radioVal = radioVal;
}