0 Replies Latest reply on Jun 19, 2008 1:02 PM by eduard francisco

    Saving multiple selectOneRadio into a List

    eduard francisco Newbie

      I've been working on a site where people can register. When the users are registering I want them to choose a couple of sub-groups belonging to super-groups. i've created a @OneToMany list in the registration like this:

      private List<Subgroup> subgroups;
      public List<Subgroup> getSubgroups() {
      return subgroups;
      public void setSubgroups(List<Subgroups> subgroups) {
      this.subgroups = subgroups;

      Now there is not a problem here but in the registration form i need to create multiple supergroup blocks containing sub-groups. I am trying to do that like this:

      <ui:repeat value="#{superGroupList.resultList}" var="oneSuperGroup">
      <h:outputText value="#{oneSuperGroup.name}" />
      <h:selectOneRadio value="#{registration.subgroup}">
      <s:selectItems value="#{oneSuperGroup.subgroup}" var="oneSubgroup" label="#{oneSubgroup.title}"/>
      <s:convertEntity />

      which will produce something like the following:

      Supergroup 1:

      -radiobuttons with subgroups

      Supergroup 2:

      -radiobuttons with subgroups


      This goes well untill i want to save the form, because then it will try to put multiple Subgroup objects AS a List, which naturally can't be done because they have to be placed IN the list. Now i've tried making it static, by creating a couple of subgroup objects into the registration class. yet this means there can only be a static amount of subgroups which i don't want.

      So my question is: Is there a way to put the Subgroup objects into the List when saving the form?

      Thanks in advance