2 Replies Latest reply on Oct 7, 2010 9:28 AM by Shawn Zimmerman

    h:selectOneRadio, s:selectItem and a4j:support

    Shawn Zimmerman Newbie

      I am having a problem with the following code.  When it renders, there are no radio buttons to select.
      <h:selectOneRadio value="#{selectPaymentTypeAction.selectedPaymentType}">
      <s:selectItems value="#{paymentTypes}" var="paymentType" label="#{paymentType.toString()}" />
      <s:convertEntity />
      <a:support event="onclick" actionListener="#{selectPaymentTypeAction.valueChanged}" reRender="paymentInput" />
      </h:selectOneRadio>


      However, with the following code, the radio buttons are visible.  The only item I removed was the a:support tag.
      <h:selectOneRadio value="#{selectPaymentTypeAction.selectedPaymentType}">
      <s:selectItems value="#{paymentTypes}" var="paymentType" label="#{paymentType.toString()}" />
      <s:convertEntity />
      </h:selectOneRadio>


      Finally, the following code also works as expected, except I am using f:selectItem instead of s:selectItems.
      <h:selectOneRadio value="#{selectPaymentTypeAction.selectedPaymentType}">
      <f:selectItem itemLabel="Cash" itemValue="Cash" />
      <f:selectItem itemLabel="Check" itemValue="Check" />
      <f:selectItem itemLabel="Credit" itemValue="Credit" />
      <a:support event="onclick" actionListener="#{selectPaymentTypeAction.valueChanged}" reRender="paymentInput" />
      </h:selectOneRadio>


      I can't figure out why the top code isn't working as expected.  I can't seem to be able to use both s:selectItems and the a4j:support tag together.  I don't get any explicit errors in the logs.


      I am using Seam 2.2.0GA and Richfaces 3.3.3Final.


        • 1. Re: h:selectOneRadio, s:selectItem and a4j:support
          Shawn Zimmerman Newbie

          I am having a problem with the following code. When it renders, there are no radio buttons to select.


          <h:selectOneRadio value="#{selectPaymentTypeAction.selectedPaymentType}">
          <s:selectItems value="#{paymentTypes}" var="paymentType" label="#{paymentType.toString()}" />
          <s:convertEntity />
          <a:support event="onclick" actionListener="#{selectPaymentTypeAction.valueChanged}" reRender="paymentInput" />
          </h:selectOneRadio>



          However, with the following code, the radio buttons are visible. The only item I removed was the a:support tag.


          <h:selectOneRadio value="#{selectPaymentTypeAction.selectedPaymentType}">
          <s:selectItems value="#{paymentTypes}" var="paymentType" label="#{paymentType.toString()}" />
          <s:convertEntity />
          </h:selectOneRadio>



          Finally, the following code also works as expected, except I am using f:selectItem instead of s:selectItems.


          <h:selectOneRadio value="#{selectPaymentTypeAction.selectedPaymentType}">
          <f:selectItem itemLabel="Cash" itemValue="Cash" />
          <f:selectItem itemLabel="Check" itemValue="Check" />
          <f:selectItem itemLabel="Credit" itemValue="Credit" />
          <a:support event="onclick" actionListener="#{selectPaymentTypeAction.valueChanged}" reRender="paymentInput" />
          </h:selectOneRadio>



          I can't figure out why the top code isn't working as expected. I can't seem to be able to use both s:selectItems and the a4j:support tag together. I don't get any explicit errors in the logs.


          I am using Seam 2.2.0GA and Richfaces 3.3.3Final.

          • 2. Re: h:selectOneRadio, s:selectItem and a4j:support
            Shawn Zimmerman Newbie

            I figured out the issue.  It was completely unrelated!


            I had the following as a backing bean:


            public class SelectPaymentTypeAction {
                 @Out(required=false)
                 private List<String> paymentTypes;
            
                 public SelectPaymentTypeAction() {
                        // Removing the line below resolved the issue!
                        paymentTypes = new List<String>();
                 }
            
                 @Factory
                 public void getPaymentTypes() {
                      Query query = entityManager.createQuery(QUERY_PAYMENT_TYPES);
                      query.setParameter(QUERY_DELETE_IND, new Boolean("true"));
                      
                      paymentTypes = query.getResultList();
                 }
            }



            See the comment line above.  Not sure what I was thinking...