You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Maxim Solodovnik <so...@gmail.com> on 2013/03/14 05:01:59 UTC

wicket:for behavior

Hello,

I'm trying to use wicket:for as follows:
<input wicket:id="rememberMe" type="checkbox" /><label
wicket:for="rememberMe"><wicket:ommessage key="288" /></label>
https://svn.apache.org/repos/asf/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/pages/auth/SignInPage.html

the resulting HTML is:
<td><input type="checkbox" name="rememberMe"><label for="id3">Remember
login</label></td>
http://demo.dataved.ru/openmeetings/html

and label for is not working :(

Am I using this feature improperly?
Wicket 6.6.0 is used

Thanks in advance

-- 
WBR
Maxim aka solomax

Re: wicket:for behavior

Posted by Igor Vaynberg <ig...@gmail.com>.
wicket:for cant set output markup id because it comes after the form
component in markup and so the form component has already been
rendered. it already sets the output of markup, but it only helps if
the label is before the component in markup.

-igor

On Thu, Mar 14, 2013 at 1:35 AM, Martin Grigorov <mg...@apache.org> wrote:
> Hi,
>
> Try with : textField.setOutputMarkupId(true).
> If this helps please file a ticket - 'wicket:for' should do this for you.
>
>
> On Thu, Mar 14, 2013 at 5:01 AM, Maxim Solodovnik <so...@gmail.com>wrote:
>
>> Hello,
>>
>> I'm trying to use wicket:for as follows:
>> <input wicket:id="rememberMe" type="checkbox" /><label
>> wicket:for="rememberMe"><wicket:ommessage key="288" /></label>
>>
>> https://svn.apache.org/repos/asf/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/pages/auth/SignInPage.html
>>
>> the resulting HTML is:
>> <td><input type="checkbox" name="rememberMe"><label for="id3">Remember
>> login</label></td>
>> http://demo.dataved.ru/openmeetings/html
>>
>> and label for is not working :(
>>
>> Am I using this feature improperly?
>> Wicket 6.6.0 is used
>>
>> Thanks in advance
>>
>> --
>> WBR
>> Maxim aka solomax
>>
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com <http://jweekend.com/>

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


Re: wicket:for behavior

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

Try with : textField.setOutputMarkupId(true).
If this helps please file a ticket - 'wicket:for' should do this for you.


On Thu, Mar 14, 2013 at 5:01 AM, Maxim Solodovnik <so...@gmail.com>wrote:

> Hello,
>
> I'm trying to use wicket:for as follows:
> <input wicket:id="rememberMe" type="checkbox" /><label
> wicket:for="rememberMe"><wicket:ommessage key="288" /></label>
>
> https://svn.apache.org/repos/asf/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/pages/auth/SignInPage.html
>
> the resulting HTML is:
> <td><input type="checkbox" name="rememberMe"><label for="id3">Remember
> login</label></td>
> http://demo.dataved.ru/openmeetings/html
>
> and label for is not working :(
>
> Am I using this feature improperly?
> Wicket 6.6.0 is used
>
> Thanks in advance
>
> --
> WBR
> Maxim aka solomax
>



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

Re: wicket:for behavior

Posted by Maxim Solodovnik <so...@gmail.com>.
Thanks a lot! *.setOutputMarkupId(**true)* helps!


On Thu, Mar 14, 2013 at 3:47 PM, Martin Grigorov <mg...@apache.org>wrote:

> On Thu, Mar 14, 2013 at 9:42 AM, Bas Gooren <ba...@iswd.nl> wrote:
>
> > We're still on wicket 1.5, so I don't know if this still applies in 6.x,
> > but the reason for this is that the wicket:for handler is executed in the
> > same order as your html.
> >
> > That means that, since your wicket:for is after the input itself, calling
> > setOutputMarkupId() on it no longer has any effect during that render.
> >
> >
> You are probably correct.
>
>
> > The solution is quite simple: wrap the input in the label:
> >
> > <label wicket:for="id3">
> >     <input wicket:id="id3" ...>
> >     <wicket:message .../>
> > </label>
> >
>
> With such markup there is no need of wicket:for at all.
>
>
> >
> > In this scenario the wicket:for is always handled before the input.
> >
> > Met vriendelijke groet,
> > Kind regards,
> >
> > Bas Gooren
> >
> > Op 14-3-2013 5:01, schreef Maxim Solodovnik:
> >
> >  Hello,
> >>
> >> I'm trying to use wicket:for as follows:
> >> <input wicket:id="rememberMe" type="checkbox" /><label
> >> wicket:for="rememberMe"><**wicket:ommessage key="288" /></label>
> >> https://svn.apache.org/repos/**asf/openmeetings/trunk/**
> >> singlewebapp/src/org/apache/**openmeetings/web/pages/auth/**
> >> SignInPage.html<
> https://svn.apache.org/repos/asf/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/pages/auth/SignInPage.html
> >
> >>
> >> the resulting HTML is:
> >> <td><input type="checkbox" name="rememberMe"><label for="id3">Remember
> >> login</label></td>
> >> http://demo.dataved.ru/**openmeetings/html<
> http://demo.dataved.ru/openmeetings/html>
> >>
> >> and label for is not working :(
> >>
> >> Am I using this feature improperly?
> >> Wicket 6.6.0 is used
> >>
> >> Thanks in advance
> >>
> >>
> >
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com <http://jweekend.com/>
>



-- 
WBR
Maxim aka solomax

Re: wicket:for behavior

Posted by Martin Grigorov <mg...@apache.org>.
On Thu, Mar 14, 2013 at 9:42 AM, Bas Gooren <ba...@iswd.nl> wrote:

> We're still on wicket 1.5, so I don't know if this still applies in 6.x,
> but the reason for this is that the wicket:for handler is executed in the
> same order as your html.
>
> That means that, since your wicket:for is after the input itself, calling
> setOutputMarkupId() on it no longer has any effect during that render.
>
>
You are probably correct.


> The solution is quite simple: wrap the input in the label:
>
> <label wicket:for="id3">
>     <input wicket:id="id3" ...>
>     <wicket:message .../>
> </label>
>

With such markup there is no need of wicket:for at all.


>
> In this scenario the wicket:for is always handled before the input.
>
> Met vriendelijke groet,
> Kind regards,
>
> Bas Gooren
>
> Op 14-3-2013 5:01, schreef Maxim Solodovnik:
>
>  Hello,
>>
>> I'm trying to use wicket:for as follows:
>> <input wicket:id="rememberMe" type="checkbox" /><label
>> wicket:for="rememberMe"><**wicket:ommessage key="288" /></label>
>> https://svn.apache.org/repos/**asf/openmeetings/trunk/**
>> singlewebapp/src/org/apache/**openmeetings/web/pages/auth/**
>> SignInPage.html<https://svn.apache.org/repos/asf/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/pages/auth/SignInPage.html>
>>
>> the resulting HTML is:
>> <td><input type="checkbox" name="rememberMe"><label for="id3">Remember
>> login</label></td>
>> http://demo.dataved.ru/**openmeetings/html<http://demo.dataved.ru/openmeetings/html>
>>
>> and label for is not working :(
>>
>> Am I using this feature improperly?
>> Wicket 6.6.0 is used
>>
>> Thanks in advance
>>
>>
>


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

Re: wicket:for behavior

Posted by Bas Gooren <ba...@iswd.nl>.
We're still on wicket 1.5, so I don't know if this still applies in 6.x, 
but the reason for this is that the wicket:for handler is executed in 
the same order as your html.

That means that, since your wicket:for is after the input itself, 
calling setOutputMarkupId() on it no longer has any effect during that 
render.

The solution is quite simple: wrap the input in the label:

<label wicket:for="id3">
     <input wicket:id="id3" ...>
     <wicket:message .../>
</label>

In this scenario the wicket:for is always handled before the input.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 14-3-2013 5:01, schreef Maxim Solodovnik:
> Hello,
>
> I'm trying to use wicket:for as follows:
> <input wicket:id="rememberMe" type="checkbox" /><label
> wicket:for="rememberMe"><wicket:ommessage key="288" /></label>
> https://svn.apache.org/repos/asf/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/pages/auth/SignInPage.html
>
> the resulting HTML is:
> <td><input type="checkbox" name="rememberMe"><label for="id3">Remember
> login</label></td>
> http://demo.dataved.ru/openmeetings/html
>
> and label for is not working :(
>
> Am I using this feature improperly?
> Wicket 6.6.0 is used
>
> Thanks in advance
>