You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by eugenebalt <eu...@yahoo.com> on 2013/06/04 21:51:26 UTC

Wicket ID sometimes changes, sometimes stays the same

Some of my components have the same static Wicket ID, but others look like
"field7" or "field5" while their ID is "field".

What is the rule governing whether an ID changes or not? And how can I
enforce a static ID? Thanks





--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-ID-sometimes-changes-sometimes-stays-the-same-tp4659238.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Wicket ID sometimes changes, sometimes stays the same

Posted by Sven Meier <sv...@meiers.net>.
Check Component#getMarkupIdImpl(), it gets the id from the markup if no 
id was explicitly set.
Perhaps you're trying to access the markup id before the component is 
attached to a page?

Sven

On 06/06/2013 05:30 PM, eugenebalt wrote:
> Solution # 2 (setMarkupId) worked for us.
>
> But Sven's Solution # 1 did not. Even after adding id="datefield"
> wicket:id="datefield" to <input type="text">, the output still contained the
> attribute id="datefield7" or something similar.
>
> # 2 works for us, but I'm just wondering, is there something preventing # 1
> from working?
>
> There are no Ajax events on this TextField. Thanks
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-ID-sometimes-changes-sometimes-stays-the-same-tp4659238p4659255.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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


Re: Wicket ID sometimes changes, sometimes stays the same

Posted by eugenebalt <eu...@yahoo.com>.
Solution # 2 (setMarkupId) worked for us.

But Sven's Solution # 1 did not. Even after adding id="datefield"
wicket:id="datefield" to <input type="text">, the output still contained the
attribute id="datefield7" or something similar.

# 2 works for us, but I'm just wondering, is there something preventing # 1
from working?

There are no Ajax events on this TextField. Thanks



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-ID-sometimes-changes-sometimes-stays-the-same-tp4659238p4659255.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Wicket ID sometimes changes, sometimes stays the same

Posted by Sebastien <se...@gmail.com>.
Hi,

Alternatively, you can use the programmatic way:
component.setOutputMarkupId(true).setMarkupId("myId");

Regards,
Sebastien.


On Tue, Jun 4, 2013 at 9:59 PM, Sven Meier <sv...@meiers.net> wrote:

> If you specify an id attribute in your markup, Wicket will use it
> unaltered:
>
>   <span wicket:id="wicketId" id="stableMarkupId"></span>
>
> Sven
>
>
> On 06/04/2013 09:51 PM, eugenebalt wrote:
>
>> Some of my components have the same static Wicket ID, but others look like
>> "field7" or "field5" while their ID is "field".
>>
>> What is the rule governing whether an ID changes or not? And how can I
>> enforce a static ID? Thanks
>>
>>
>>
>>
>>
>> --
>> View this message in context: http://apache-wicket.1842946.**
>> n4.nabble.com/Wicket-ID-**sometimes-changes-sometimes-**
>> stays-the-same-tp4659238.html<http://apache-wicket.1842946.n4.nabble.com/Wicket-ID-sometimes-changes-sometimes-stays-the-same-tp4659238.html>
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@wicket.**apache.org<us...@wicket.apache.org>
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Wicket ID sometimes changes, sometimes stays the same

Posted by Sven Meier <sv...@meiers.net>.
If you specify an id attribute in your markup, Wicket will use it unaltered:

   <span wicket:id="wicketId" id="stableMarkupId"></span>

Sven

On 06/04/2013 09:51 PM, eugenebalt wrote:
> Some of my components have the same static Wicket ID, but others look like
> "field7" or "field5" while their ID is "field".
>
> What is the rule governing whether an ID changes or not? And how can I
> enforce a static ID? Thanks
>
>
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-ID-sometimes-changes-sometimes-stays-the-same-tp4659238.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


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