ke 29. kesäk. 2022 klo 12.38 Daniel Radünz (ihmehlm...@gmx.de) kirjoitti:

> Hello everybody,
>
> I'm wondering if there is a way in Wicket to generate unique html IDs and
> to then add them in other places in the html, without having to write any
> boiler plate code in each panel that I have.
>
> For example in the following panel I need the ID of the h1 tag to be put
> into the aria-labelledby attribute in the section tag.
> <wicket:panel>
>         <section class="card" aria-labelledby="sectionheader">
>                 <div class="card-header"><h1 id="sectionheader">Lorem
> ipsum dolor sit amet</h1></div>
>                 <div class="card-content">Content ...</div>
>         </section>
> </wicket:panel>
>
> Hardwiring it like in this example of course won't work if I use the same
> panel class multiple times within a page due to duplicate html IDs.
>
> While I know I could add WebMarkupContainers for the section and the h1 to
> my Java code and manually wire them together with an AttributeModifier in
> Wicket, I woud prefer to have some application wide code which recognizes
> this constellation in the html file and automatically generates and inserts
> the IDs.
>

You can extend and create your own flavor of WebMarkupContainer which does
all that you need or even a panel if the html is repetitive as well.

**
Martin


> Maybe somebody can push me in the right direction, how I could accomplish
> this with Wicket, if it's possible at all.
>
> Kind regards,
> Daniel
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to