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.

On Thu, Oct 13, 2011 at 8:36 AM, Matthias Keller
<matthias.kel...@ergon.ch> wrote:
> Hi
>
> I really like the wicket:for feature; makes writing the HTML pages much less
> tedious -- except that it appears I have to use  setOutputMarkupId() on each
> and every referenced Component - is this how it is expected to work? I
> expected that those IDs should be set automatically without a warning in the
> log every time?
> The wicket XHTML-Page also doesn't mention anything about that.
> We're using Wicket 1.5.1
>
> We will also have to access certain input fields by javascript methods,
> what's the recommended way to do this since we cannot determine the IDs
> beforehand?
>
> Thank you very much
>
> Matt
>
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to