我想有三个单选按钮,前两个有静态值,但第三个,如果选中,用户可以在inputText框中输入任何内容。我可以使用此代码获取布局,但表单不会提交,我不会在任何地方收到错误。
<p:outputPanel id="customPanel" style="margin-bottom:10px">
<p:selectOneRadio id="customRadio" value="#{backbean.radioselect}" layout="custom">
<f:selectItem itemLabel="Choice 1" itemValue="choice1" />
<f:selectItem itemLabel="Choice 2" itemValue="choice2" />
<f:selectItem itemLabel="Custom" itemValue="#{backbean.radioselect != 'choice1' and backbean.radioselect != 'choice2' ? backbean.radioselect : ''}" />
</p:selectOneRadio>
<h:panelGrid columns="2">
<p:radioButton id="choice1" for="customRadio" itemIndex="0" />
<h:outputLabel for="choice1" value="Choice 1" />
<p:radioButton id="choice2" for="customRadio" itemIndex="1" />
<h:outputLabel for="choice2" value="Choice 2" />
<p:radioButton id="choiceCustom" for="customRadio" itemIndex="2" />
<p:inputText style="width: 100%;" value="#{backbean.radioselect != 'choice1' and backbean.radioselect != 'choice2' ? backbean.radioselect : ''}" />
</h:panelGrid>
</p:outputPanel>