[
https://issues.apache.org/jira/browse/WW-3429?focusedWorklogId=1003913&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1003913
]
ASF GitHub Bot logged work on WW-3429:
--------------------------------------
Author: ASF GitHub Bot
Created on: 06/Feb/26 14:45
Start Date: 06/Feb/26 14:45
Worklog Time Spent: 10m
Work Description: lukaszlenart opened a new pull request, #1570:
URL: https://github.com/apache/struts/pull/1570
## Summary
- Add `struts.ui.checkbox.hiddenPrefix` constant to allow configuring the
checkbox hidden field prefix
- Default value `__checkbox_` maintains backward compatibility
- Addresses HTML validation warnings about double underscores (HTML Tidy)
- Users can set `struts_checkbox_` or other prefix for HTML5 compliance
Fixes [WW-3429](https://issues.apache.org/jira/browse/WW-3429)
## Changes
| File | Change |
|------|--------|
| `StrutsConstants.java` | Add `STRUTS_UI_CHECKBOX_HIDDEN_PREFIX` constant |
| `default.properties` | Add default value `__checkbox_` |
| `Checkbox.java` | Inject constant, pass to template |
| `CheckboxInterceptor.java` | Inject constant, use in prefix matching |
| `simple/checkbox.ftl` | Use `${attributes.hiddenPrefix}` |
| `html5/checkbox.ftl` | Use `${attributes.hiddenPrefix}` |
| `CheckboxHandler.java` | Get prefix from component parameters |
| `CheckboxInterceptorTest.java` | Add tests for configurable prefix |
| `CheckboxTest.java` (javatemplates) | Fix test for correct hidden field
value |
## Configuration
**Default (backward compatible):**
No configuration needed - uses `__checkbox_`
**HTML5 Compliant:**
```xml
<constant name="struts.ui.checkbox.hiddenPrefix" value="struts_checkbox_"/>
```
Or in `struts.properties`:
```properties
struts.ui.checkbox.hiddenPrefix=struts_checkbox_
```
## Test plan
- [x] Run `CheckboxInterceptorTest` - 12 tests pass
- [x] Run `CheckboxTest` (core) - 21 tests pass
- [x] Run `CheckboxTest` (javatemplates) - 6 tests pass
- [ ] Manual verification with showcase app
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Issue Time Tracking
-------------------
Worklog Id: (was: 1003913)
Remaining Estimate: 0h
Time Spent: 10m
> <input> tag generated by <s:checkbox> produce HTML warning in validators
> ------------------------------------------------------------------------
>
> Key: WW-3429
> URL: https://issues.apache.org/jira/browse/WW-3429
> Project: Struts 2
> Issue Type: Bug
> Components: Core Interceptors, Other
> Affects Versions: 2.1.8.1
> Environment: Apache Tomcat 5.5, 6.0.18 running on Win 32 and Fedora
> Code Linux x86_64. Actually, bug is relevant to any environment.
> Reporter: Alexey Malev
> Assignee: Lukasz Lenart
> Priority: Minor
> Labels: checkbox, hidden, html, input, warning
> Fix For: 7.2.0
>
> Attachments: CheckboxInterceptor.java, checkbox.ftl, diff.txt
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> <s:checkbox> tag with default xhtml theme produce an <input> tag, like that
> one:
> <input type="hidden" id="__checkbox_is_vacancy_open"
> name="__checkbox_vacancy.open" value="true" />
> produces HTML Tidy validator warning about an attribute name and ID starting
> with two "_" signs. So, here is a patch I suggest to resolve this issue:
> I changed FreeMarker template and a checkbox interceptor code in such a way
> that prefix of that input no longer produce warning.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)