This content has been marked as final.
Show 3 replies
-
1. Re: selectOneRadio with reRender to activate optional fields
ilya_shaikovsky Nov 4, 2008 5:14 AM (in response to alain94040)Something like this:
<h:form id="myform"> <h:panelGrid columns="1"> <h:selectOneRadio value="#{userBean.name}"> <f:selectItem itemLabel="register" itemValue="0"/> <f:selectItem itemLabel="login" itemValue="1"/> <a4j:support event="onchange" reRender="out"></a4j:support> </h:selectOneRadio> <h:panelGroup id="out"> <h:outputText rendered="#{userBean.name == 1}" value="enter your nickname"/> <h:inputText rendered="#{userBean.name == 1}" /> </h:panelGroup> </h:panelGrid> </h:form>
should works just as you need. -
2. Re: selectOneRadio with reRender to activate optional fields
alain94040 Nov 4, 2008 1:56 PM (in response to alain94040)Thanks, that's the right way to do what I want.
Bonus points: any idea how to have selectOneRadio have a layout of Page (as in a bullet list, one item per line), but insert the optional field "in line" with the first bullet?
The only way I can think of is have separate independent checkmarks and connect their behavior (when one is on, the other ones are off) via Javascript, which would be quite ugly. Any better idea? -
3. Re: selectOneRadio with reRender to activate optional fields
ilya_shaikovsky Nov 5, 2008 4:38 AM (in response to alain94040)something like this?
<style> .top{ vertical-align:top; } ` </style> <h:form id="myform"> <h:panelGrid columns="2" columnClasses="top,top"> <h:selectOneRadio value="#{userBean.name}" layout="pageDirection"> <f:selectItem itemLabel="login" itemValue="1"/> <f:selectItem itemLabel="register" itemValue="0"/> <a4j:support event="onchange" reRender="out"></a4j:support> </h:selectOneRadio> <h:panelGroup id="out"> <h:outputText rendered="#{userBean.name == 1}" value="enter your nickname"/> <h:inputText rendered="#{userBean.name == 1}" /> </h:panelGroup> </h:panelGrid> </h:form>