6 Replies Latest reply on Mar 25, 2008 8:46 PM by Joe Greene

    submitting selected option when using <s:convertEnum...>

    Joe Greene Novice

      Hi -
      I have a pair of select boxes, and the options for the 2nd one is dependent on the selection made in the 1st one.  Here's the code I use for this:


      <h:outputLabel for="serviceId" value="Service:" />
      <h:selectOneMenu id="serviceId" value="#{myuser.service}">
         <s:selectItems value="#{serviceRankListManager.services}"
         var="service" label="#{service.serviceText}" />
         <s:convertEnum />
         <a4j:support event="onchange" reRender="rankId" immediate="true" />
      </h:selectOneMenu>
                              
      <h:outputLabel for="rankId" value="Rank:" />
      <h:selectOneMenu id="rankId" value="#{myuser.rank}">
         <s:selectItems value="#{userManager.userRanks}" 
         var="rank" label="#{rank.rankText}" />
         <s:convertEnum/>
      </h:selectOneMenu>



      I want to be able to submit (via ajax) the selected option in the first select box so that the new list of ranks can be generated based on the selected service.  So the first thing I thought of was to add an a4j:actionparam inside the aj4:support... tag that assigned the selected value to a property in my manager bean.  Is there a clean way to do this considering that I'm using the enum converter (service is an enum property of User)?  It might be easier (not sure) using a List of SelectItem objects, but I don't really want to do that unless I have to.  So the bottom line is, Can I use the a4j:actionparam... tag wrapped inside the a4j:support... tag to pass back the selected enum value to the manager bean?  If so, how do I specify the enum value in the a4j:actionparam tag?


      Any help would be greatly appreciated.  Thank you.


      - Joe