开发者

How to use h:selectOneMenu in f:selectItem?

开发者 https://www.devze.com 2023-03-16 23:00 出处:网络
<h:selectOneRadio id=\"profiles\" layout=\"pageDirection\" value=\"#{bean.selectedProfile}\" style=\"font-size:12px;\">
    <h:selectOneRadio id="profiles" layout="pageDirection" value="#{bean.selectedProfile}" style="font-size:12px;">

       <f:selectItem itemValue="0" itemLabel="#{messages.msg_profile1} ">
          <h:selectOneMenu id="countries" value="#{bean.selectedCountry}" required="false"    style="width:190px">
            <f:selectItems value="#{bean.countries}" />
          </h:selectOneMenu>    
        </f:selectItem>

        <f:selectItems value="#{fraudBinPageBean.profiles}"/>    

    </h:selectOneRadio>

I have writ开发者_Python百科ten above code in my app. It is working fine. But select box displaying above the radio button. My requirement display the select box beside the radio button.

Can you please help me what is the problem?


Are you sure that it is working correctly? Referring to this answer it is not possible since the body of the f:selectItem tag must be empty.

Try to redesign your form that you get along without the nested h:selectOneMenu.


You want to keep your radio button and Select box in same line. This is more related to CSS.

Try This code.

    <h:selectOneRadio id="profiles" layout="pageDirection" 
value="#{bean.selectedProfile}" style="font-size:12px;display:inline">
 <f:selectItems value="#{fraudBinPageBean.profiles}"/>  
   </h:selectOneRadio>

    <f:selectItem itemValue="0" itemLabel="#{messages.msg_profile1} ">
              <h:selectOneMenu id="countries" value="#{bean.selectedCountry}"  required="false"    style="width:190px">
                <f:selectItems value="#{bean.countries}" />
    </h:selectOneMenu>    

as shown in above code Add CSS property Display:inline to your style attribute of selectoneradio

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号