Hi all, We use wicket:for extensively in our apps, to let wicket automatically connect form labels to their form components. This works really well, with one little issue: when we have a CheckGroup (or RadioGroup), this leads to an error being logged on every render:
Markup id set on a component that renders its body only. Markup id: id34, component id: categories, type: class org.apache.wicket.markup.html.form.CheckGroup, path: class [page class omitted]:categories. The wicket:for attribute is handled in AutoLabelResolver. That resolver forces setOutputMarkupId(true) on the form component in three locations: 1. During component resolution 2. In the AutoLabel ctor (getLabelIdFor calls getMarkupId() on the form component) 3. In the AutoLabel onComponentTag method (when it puts the “for” attribute it calls getMarkupId() on the component) Now essentially I don’t think automatically connecting a label with e.g. a CheckGroup is a bad thing, right? But obviously there is no point in outputting a “for” attribute when the CheckGroup itself is not present in the HTML output. I mean, the simplest thing to do is to remove the “wicket:for”-attribute from labels of CheckGroups and RadioGroups; But then we also lose the automatic addition of the required and error css classes. Would it make sense to handle this special case in AutoLabelResolver? So FormComponents which only render a body get special treatment? Met vriendelijke groet, Kind regards, Bas Gooren
