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

CheckboxList does not render correctly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.3.4.1
    • 2.3.12
    • None
    • Centos/tomcat

    Description

      Hello,

      The CheckboxList does not handle correctly the params.get("nameValue");, as for the list they are an array of strings.

      The following code makes it work correctly, CheckboxListHandler.java

      Boolean checked = false;
      if (itemKeyStr != null) {
       String[] parms = (String[]) params.get("nameValue");
       for (String parm : parms) {
        if (checked = parm.equalsIgnoreCase(itemKeyStr))
         break;
       }
      }
                      
      //Checkbox button section
      Attributes a = new Attributes();
       a.add("type", "checkbox")
       .add("name", name)
       .add("value", itemKeyStr)
       .addIfTrue("checked", checked)  <<< CHANGED
       .addIfTrue("readonly", params.get("readonly"))
       .addIfTrue("disabled", disabled)
       .addIfExists("tabindex", params.get("tabindex"))
       .addIfExists("id", name + "-" + Integer.toString(cnt++));
      

      Attachments

        Activity

          People

            lukaszlenart Lukasz Lenart
            ghuber Greg Huber
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: