[ 
https://issues.apache.org/jira/browse/WW-5168?focusedWorklogId=725902&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-725902
 ]

ASF GitHub Bot logged work on WW-5168:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 14/Feb/22 02:26
            Start Date: 14/Feb/22 02:26
    Worklog Time Spent: 10m 
      Work Description: JCgH4164838Gh792C124B5 commented on a change in pull 
request #531:
URL: https://github.com/apache/struts/pull/531#discussion_r805209191



##########
File path: 
plugins/javatemplates/src/main/java/org/apache/struts2/views/java/simple/CheckboxHandler.java
##########
@@ -35,29 +36,33 @@ public void generate() throws IOException {
         String id = (String) params.get("id");
         String name = (String) params.get("name");
         Object disabled = params.get("disabled");
+        boolean submitUnchecked = 
Boolean.parseBoolean(Objects.toString(params.get("submitUnchecked"), "false"));
 
         attrs.add("type", "checkbox")
-                .add("name", name)
-                .add("value", fieldValue)
-                .addIfTrue("checked", params.get("nameValue"))
-                .addIfTrue("readonly", params.get("readonly"))
-                .addIfTrue("disabled", disabled)
-                .addIfExists("tabindex", params.get("tabindex"))
-                .addIfExists("id", id)
-                .addIfExists("class", params.get("cssClass"))
-                .addIfExists("style", params.get("cssStyle"))
-                .addIfExists("title", params.get("title"));
+            .add("name", name)
+            .add("value", fieldValue)
+            .addIfTrue("checked", params.get("nameValue"))
+            .addIfTrue("readonly", params.get("readonly"))
+            .addIfTrue("disabled", disabled)
+            .addIfExists("tabindex", params.get("tabindex"))
+            .addIfExists("id", id)
+            .addIfExists("class", params.get("cssClass"))
+            .addIfExists("style", params.get("cssStyle"))
+            .addIfExists("title", params.get("title"));
         start("input", attrs);
         end("input");
 
-        //hidden input
-        attrs = new Attributes();
-        attrs.add("type", "hidden")
+        if (!submitUnchecked) {

Review comment:
       Hi @lukaszlenart .  In a recent JIRA update, @gregh3269 has indicated 
that they think the check/flag is inverted here, based on their testing.  
   So, their recommendation is this line should be: `if (submitUnchecked) {` 
instead.
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 725902)
    Time Spent: 2h 10m  (was: 2h)

> Fix missing submitUnchecked and broken disabled attributes in Javatemplates 
> checkbox tag
> ----------------------------------------------------------------------------------------
>
>                 Key: WW-5168
>                 URL: https://issues.apache.org/jira/browse/WW-5168
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Plugin - Java Templates
>    Affects Versions: 2.5.29
>            Reporter: Greg Huber
>            Priority: Minor
>             Fix For: 2.6
>
>          Time Spent: 2h 10m
>  Remaining Estimate: 0h
>
> Add missing attribute submitUnchecked to java templates checkbox tag so it 
> matches the main freemarker template.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to