jsf 2.2 - Show a hidden radio button when another radio button is checked in JSF -
jsf 2.2 - Show a hidden radio button when another radio button is checked in JSF -
i'm trying hide/show jsf panels based on ui events. more specifically, have many radio buttons, every radio buttons should exists within own panel. need create hidden panel visible based on radio button click. how can this?
instead of using css attribute visibility
, should consider either render radio button - or not - depending on value of first radio button.
just maintain in mind, cannot update
component has not been rendered, parent:
<h:form> <h:panelgroup id ="grp1"> <h:selectoneradio value="#{testcontroller.radio1}"> <f:selectitem itemvalue="show" itemlabel="show next radio" /> <f:selectitem itemvalue="hide" itemlabel="hide next radio" /> <f:ajax render="grp2"></f:ajax> </h:selectoneradio> </h:panelgroup> <h:panelgroup id ="grp2"> <h:selectoneradio value="#{testcontroller.radio2}" rendered="#{testcontroller.radio1 eq 'show'}"> <f:selectitem itemvalue="show" itemlabel="show next radio" /> <f:selectitem itemvalue="hide" itemlabel="hide next radio" /> </h:selectoneradio> </h:panelgroup> </h:form>
with baking bean
@named @viewscoped public class testcontroller implements serializable { private string radio1; private string radio2; //+getter , setter }
jsf jsf-2.2
Comments
Post a Comment