[
https://issues.apache.org/jira/browse/WW-3792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18128185#comment-18128185
]
Lukasz Lenart commented on WW-3792:
-----------------------------------
This is consistent behaviour, not a checkbox-specific bug. Under the
{{css_xhtml}} theme every control wraps its label and control in {{<div>}} only
for {{labelPosition="top"}} (the default) and in {{<span>}} for any other
position — see {{css_xhtml/controlheader-core.ftl}} and
{{css_xhtml/controlheader.ftl}}. A textfield with {{labelPosition="left"}}
renders exactly the same spans as the checkbox; the comparison in the
description was a textfield at the default {{top}} against a checkbox at
{{left}}. The templates already behaved this way in 2.3.1.2.
[PR #2041|https://github.com/apache/struts/pull/2041] adds a test that renders
a textfield and a checkbox, both {{css_xhtml}} with {{labelPosition="left"}},
and asserts they use the same wrapper elements, so the checkbox stays in step
with the other controls.
If you need {{<div>}} wrappers for a left-positioned label, override the
{{css_xhtml}} templates in your application (or extend the theme).
Closing as Not A Problem.
> s:checkbox (org.apache.struts2.components.Checkbox) generates span instead of
> div when using labelposition="left"
> -----------------------------------------------------------------------------------------------------------------
>
> Key: WW-3792
> URL: https://issues.apache.org/jira/browse/WW-3792
> Project: Struts 2
> Issue Type: Bug
> Components: Core Actions
> Affects Versions: 2.3.1.2
> Environment: Tomcat 6 / JDK 1.5
> Reporter: emmanuelg
> Assignee: Lukasz Lenart
> Priority: Major
> Fix For: 7.5.0
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> When using theme="css_xhtml", most of components
> (s:textfield,s:textarea,s:radio,s:select) generate code like that :
> <div class="wwgrp">
> <div class="wwlbl">
> <LABEL>
> </div>
> <div class="wwctrl" >
> <Component = input or select or textarea>
>
> </div>
> </div>
> Wheras if you use s:checkbox with labelposition="left" it generates something
> like that (span instead of div) :
> <s:checkbox key="myKeyValue" labelposition="left" />
> generates :
> <div class="wwgrp">
> <span class="wwlbl">
> <LABEL>
> </span>
> <span class="wwctrl" >
> <Component = input or select or textarea>
>
> </span>
> </div>
> When you use css_xhtml and a css to display a form, this is a real problem.
> As a workaround, you have to display checkbox using parentThem=simple, and
> generate div by yourself.
> Maybe this problem is due to the fact that by default, all component have :
> - label at left
> - value at right
> Expect for checkbox that has :
> - label at right
> - value at left
--
This message was sent by Atlassian Jira
(v8.20.10#820010)