7 Replies Latest reply on Mar 1, 2011 4:05 PM by mr1azl

    how add image inside h:selectOneRadio

    spiritfox26

      I try this, but not works. I search in google but i'm not sure if i can do this.

       

      <h:selectOneRadio layout="pageDirection" styleClass="labelWhite" value="#{administracionBean.idioma}">
           <f:selectItem itemLabel="#{msg.inglesLabel}" itemValue="en_US">
                <h:graphicImage value="/images/UnitedKindom.png" />
           </f:selectItem>
           <f:selectItem itemLabel="#{msg.espaniolLabel}" itemValue="es_ES">
                <h:graphicImage value="/images/Spain.png" />
           </f:selectItem>
      </h:selectOneRadio>
      

       

      Captura.PNG

       

      I need to put the images near the radios, but there are always above.

       

      Anyone have a solution?

       

      If i can't do this, what richfaces component recommended to do this?

       

      Thanks in advanced

        • 1. how add image inside h:selectOneRadio
          ilya40umov

          f:selectItem definetly does not support a nested h:graphicImage. But may be you can try to do this with CSS. The only problem is that f:selectItem does not have any CSS attributes either.

          The simplest way out is to create HTML+JS based solution which should pass user's choise to the server side in a hidden field.


          • 2. how add image inside h:selectOneRadio
            spiritfox26

            Thanks for your answer.

             

            Regards

            • 3. how add image inside h:selectOneRadio
              mr1azl

              hey Agustin,

              I have the same problem if u found a solution plz let me know

               

              thx!!

              • 4. Re: how add image inside h:selectOneRadio
                spiritfox26

                Hi Marl, i resolve it, but not is the best solution, i use some h:panelGrid.

                 

                <h:panelGrid columns="2">
                     <h:selectOneRadio layout="pageDirection" styleClass="labelWhite" value="#{administracionBean.idioma}">
                          <f:selectItem itemLabel="#{msg.inglesLabel}" itemValue="en_US"/>
                          <f:selectItem itemLabel="#{msg.espaniolLabel}" itemValue="es_ES"/>
                     </h:selectOneRadio>
                     <h:panelGrid columns="1">
                          <h:graphicImage value="/images/UnitedKindom.png" />
                          <h:graphicImage value="/images/Spain.png" />
                     </h:panelGrid>
                </h:panelGrid>
                

                 

                The result

                 

                Captura.PNG

                 

                Regards

                • 5. Re: how add image inside h:selectOneRadio
                  mr1azl

                  Thx Agustin,

                   

                  I see what u did but that would not help me much.  In fact i want to use it with a selectOneMenu : like this !!

                   

                  http://a2.sphotos.ak.fbcdn.net/hphotos-ak-ash4/184749_1882961358319_1369892100_2146655_1287005_n.jpg

                  • 6. how add image inside h:selectOneRadio
                    danielk

                    Than you should look at suggestion box instead of selectOneRadio. With this tag you have the ability to create drop down lists by using complex java objects. I think in richfaces livedemo they already used flags combined with names as example. But much simpler would be to use a combobox, perhaps with the right flag, after user has chosen a language.

                    • 7. how add image inside h:selectOneRadio
                      mr1azl

                      aaaaaaah thx i will use a drop down menu !! I ve already used it with pics !! thx a lot !