On 2011-10-13 17:52, Igor Vaynberg wrote:
On Thu, Oct 13, 2011 at 2:08 AM, Martin Grigorov<mgrigo...@apache.org>  wrote:
wicket:for works as IComponentResolver, i.e. while rendering the final
markup Wicket will see a ComponentTag with the special 'wicket:for'
attribute and will transform it to<label for="...">.

Wicket can set automatically the this flag for and actually it does it:

if (!component.getOutputMarkupId())
{
        component.setOutputMarkupId(true);      // HERE
        if (!component.hasBeenRendered())       // BUG ?!
        {
                logger.warn(
                        "Component: {} is referenced via a wicket:for attribute 
but does
not have its outputMarkupId property set to true",
                        component.toString(false));
        }
}

But it could be too late if your markup looks like:<input id="id1"/>
<label for="id1">...</label>, i.e. the label will be rendered AFTER
the related form component and setting the flag will be too late.

@Igor: is it a bug the line with 'hasBeenRendered()' ? I think the
negation shouldn't be there.
indeed looks like a bug, fixing
Thanks a lot! That would explain why I'm seeing a lot of those messages even though we always have the label before the input field..

Now to my other question: What is the best way to combine wicket:for with JS that needs access to certain input fields? Wicket generates an ID so the JS somehow needs to know about it - is there an easy way to achieve that?

Thanks
Matt

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to