4 Replies Latest reply on Mar 23, 2010 10:20 PM by sburgula1

    h:selectOneRadio and converters

    reedmd
      I have been working with converters and the h:selectOneMenu and h:selectOneRadio tags.  Everything seems to work fine for the drop downs, however the radio buttons are not funtioning properly.  I have tried:

      <f:selectItems ... with
      <f:converter converterId="optionConverter" />

      and

      <s:selectItems ... with
      <s:convertEntity />

      Both appear to be called properly for radio buttons, however if an option is selected prior to arriving at the page, the option does not appear selected on the page.  If I change the selectOneRadio tage to selectOneMenu but change nothing else, the selection renders correctly. 

      Has anyone experienced this same issue?  Is there a solution or am I doing something wrong?  It seems to me it may be a bug but I have found very little online about others doing anything similar.
        • 1. Re: h:selectOneRadio and converters
          gonorrhea

          here's an example from DAllen's book:


          <h:selectOneRadio id="gender" value="#{newGolfer.gender}">
          <s:convertEnum/>
          <s:enumItem enumValue="MALE" label="Male"/>
          <s:enumItem enumValue="FEMALE" label="Female"/>
          </h:selectOneRadio>



          there was nothing else on h:selectOneRadio.  I have only used the s:convertEntity with h:selectOneMenu...  Maybe somebody else knows the answer.


          Also, always post the Seam version (and/or Richfaces version, if applicable) if you think it may be a bug...

          • 2. Re: h:selectOneRadio and converters
            reedmd

            Thanks for the advice.  Is there a way to pass it a list such as with s:selectItems?  Also does the enum route work for dropdowns as well?


            Richfaces: 3.2.2.SR1
            Seam: 2.1.1.GA

            • 3. Re: h:selectOneRadio and converters
              wilczarz.wilczarz.gmail.com

              s:selectItems works fine with h:selectOneRadio:


              <h:selectOneRadio value="#{ bean.someEntity }" >
                <s:selectItems var="val" value="#{otherBean.entityList}" label="#{val.label}" />
                <s:convertEntity />
              </h:selectOneRadio>

              • 4. Re: h:selectOneRadio and converters

                Does h:selectOneRadio implicitly convert if the value component is Short type and the s:selectItems list is a list of String.  I am giving it a list of String(1,2,3,4,5) in the radio buttons and the value selected should be Short.


                Could you provide a equivalent example please.


                Looking forward to hearing from you soon.


                thanks
                Sai