Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-1557

multiple="true" does not work in s:select tag

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • 2.0.1
    • 2.0.3
    • Plugin - Tags
    • None

    Description

      The comments in the code for the multiple attribute in the SelectTag states:
      "Creates a multiple select. The tag will pre-select multiple values if the values are passed as an Array (of appropriate types) via the value attribute. Passing a Collection may work too? Haven't tested this."

      I have tried to use this both with a Collection, an Array, and a single value, and as far as I can tell none work. It does generate a select with the multiple attribute set, but I cannot figure out how to get any of the options to be marked as selected.

      In the following tag I have tried value="%

      {event.communities}" value="%{event.communities.toArray()}" value="%{event.communities[0]}" and many other variants, with no success. I have displayed the content of event.communities (and lots of other variations) using s:property tags, so I know that the values are there...

      <s:select label="%{getText('event.communities')}"
      name="eventCommunityShortNames"
      multiple="true"
      value="%{event.communities}

      "
      list="%

      {user.canCreateEventsForCommunities}

      "
      listKey="shortName"
      listValue="fullName"
      size="4"/>

      Attachments

        Activity

          People

            ddewolf David H. DeWolf
            dnewfield Dale Newfield
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: