You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Andreas Kappler <an...@jato-consulting.de> on 2015/04/09 13:45:44 UTC
wicket:for does not work if used after the referenced component
Hi,
in Wicket 6.18 this code works as expected ("for" attribute of <label>
is set to id of <input> and id of input is written to HTML):
<label wicket:for="cb">Label</label> <input type="checkbox"
wicket:id="cb"/>
However if reversed, the id of the <input> is not written to the HTML
and therefore the <label> does not work properly:
<input type="checkbox" wicket:id="cb"/> <label wicket:for="cb">Label</label>
My guess is that the AutoLabelResolver calls the getMarkupId method of
the referenced FormComponent too late. A workaround is to call
setOutputMarkupId explictily on the FormComponent.
I can create a JIRA issue and quickstart (should be easily reproducible)
if needed.
Thanks!
Best Regards,
Andreas
Re: wicket:for does not work if used after the referenced component
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
On Apr 9, 2015 2:46 PM, "Andreas Kappler" <
andreas.kappler@jato-consulting.de> wrote:
>
> Hi,
>
> in Wicket 6.18 this code works as expected ("for" attribute of <label> is
set to id of <input> and id of input is written to HTML):
>
> <label wicket:for="cb">Label</label> <input type="checkbox"
wicket:id="cb"/>
>
> However if reversed, the id of the <input> is not written to the HTML and
therefore the <label> does not work properly:
>
> <input type="checkbox" wicket:id="cb"/> <label
wicket:for="cb">Label</label>
>
> My guess is that the AutoLabelResolver calls the getMarkupId method of
the referenced FormComponent too late. A workaround is to call
setOutputMarkupId explictily on the FormComponent.
>
> I can create a JIRA issue and quickstart (should be easily reproducible)
if needed.
Yes, please attach a quickstart app to a ticket if it is reproducible.
Thanks!
>
> Thanks!
>
> Best Regards,
> Andreas