Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
5.0.5
-
None
Description
The Label component assumes validation and label strings are to be the same.
This is sometimes not desired, however.
Our use-case is points displayed as part of a todo item name:
[ ] 3 points
[ ] 7 points
...
Using code something like this:
<div t:type="loop" t:source="itemList" t:value="item" t:volatile="true">
<input t:type="checkbox" t:id="itemCheck" id="itemCheck" t:value="item.done" t:label="item.name"/>
<label t:type="label" for="itemCheck">
<span class="points">${item.points} ${message:points}</span>
</label>
</div>
Having explored several solutions to this problem (auto body render, body render/discard/replace parameters, mixins, body
blocks), I prefer one which aids previewability.
A renderBody parameter allows the body to render, assisted by the improved Any component - see TAPESTRY-1733.
<label t:type="label" for="itemCheck" t:renderBody="true">
<span t:type="Any" t:body="${item.points} ${message:points}" class="points">10 points</span>
</label>
(Note: this doesn't work in 5.0.5 because of the invariant expansions bug which is fixed in SVN.)
Cheers,
Nick.
Attachments
Issue Links
- relates to
-
TAPESTRY-2277 Removing Label body should be parameterizable
- Closed