You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Christopher Merrill <ch...@webperformance.com> on 2015/07/09 21:55:59 UTC
How to link an anchor to another element id, all within a repeater (DataView)?
I have this bit of HTML:
<a href="#confirmStartTestDialog"
class="action">Start</a>
<div id="confirmStartTestDialog" class="modalDialog">
<div>
<a href="#close" title="Close"
class="close">X</a>
<h2>Confirm controller start</h2>
<p>Are you sure you want to do this?</p>
<a wicket:id="start-cloud-controller"
href="#">Start it!</a>
</div>
</div>
The "Start" link in the first line references, by ID, the following DIV to
open a modal dialog (simulated in CSS) to confirm the user's action. Within
that dialog is a confirm link. This all works great.
When I put this into a repeater (DataView), I think I will end up with
multiple elements with the same ID...which implies that references by ID
will not work as expected. The ID in the anchor and the div need to be
dynamic and match up.
What is the Wicket way to do this?
TIA!
Chris
Re: How to link an anchor to another element id, all within a
repeater (DataView)?
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
You will have to make both of them Wicket components.
>From there on it is easy.
Martin Grigorov
Freelancer. Available for hire!
Wicket Training and Consulting
https://twitter.com/mtgrigorov
On Thu, Jul 9, 2015 at 10:55 PM, Christopher Merrill <
chris@webperformance.com> wrote:
> I have this bit of HTML:
>
> <a href="#confirmStartTestDialog"
> class="action">Start</a>
> <div id="confirmStartTestDialog" class="modalDialog">
> <div>
> <a href="#close" title="Close"
> class="close">X</a>
> <h2>Confirm controller start</h2>
> <p>Are you sure you want to do this?</p>
> <a wicket:id="start-cloud-controller"
> href="#">Start it!</a>
> </div>
> </div>
>
>
> The "Start" link in the first line references, by ID, the following DIV to
> open a modal dialog (simulated in CSS) to confirm the user's action. Within
> that dialog is a confirm link. This all works great.
>
> When I put this into a repeater (DataView), I think I will end up with
> multiple elements with the same ID...which implies that references by ID
> will not work as expected. The ID in the anchor and the div need to be
> dynamic and match up.
>
> What is the Wicket way to do this?
>
> TIA!
> Chris
>