Modify element attribute, preserve content

2011-01-26 Thread Alexandros Karypidis
Hello,

I have the following case which I do not know how to handle with Wicket:

I have an element (specifically it is an a href=.../a link) for which I 
need to generate an attribute's value dynamically (specifically, I need to set 
the href attribute at runtime), but I need to preserve the static content of 
the page.

For example, my HTML file is:

a wicket:id=myTargetspan class=x/spansome static text/a

What do I have to do to produce:

a href=dynamically generated targetspan class=x/spansome static 
text/a

So far, I've always replaced the entire content of an element with that 
generated by some wicket component, but this is the first time I've needed to 
filter part of the DOM and target something very specific in the middle of 
the 
tree, without affecting the rest of the tree...




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



Re: Modify element attribute, preserve content

2011-01-26 Thread Bas Gooren
Use a WebMarkupContainer and add a SimpleAttributeModifier behavior to 
it. It will not touch the contents of the tag it's attached to, leaving 
your own html as it is.


Bas

Op 26-1-2011 22:38, Alexandros Karypidis schreef:

Hello,

I have the following case which I do not know how to handle with Wicket:

I have an element (specifically it is ana href=.../a  link) for which I
need to generate an attribute's value dynamically (specifically, I need to set
the href attribute at runtime), but I need to preserve the static content of
the page.

For example, my HTML file is:

a wicket:id=myTargetspan class=x/spansome static text/a

What do I have to do to produce:

a href=dynamically generated targetspan class=x/spansome static
text/a

So far, I've always replaced the entire content of an element with that
generated by some wicket component, but this is the first time I've needed to
filter part of the DOM and target something very specific in the middle of the
tree, without affecting the rest of the tree...




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



Re: Modify element attribute, preserve content

2011-01-26 Thread Bas Gooren
Or, come to think of it, since you want to generate a href yourself on a 
link tag, use ExternalLink 
http://wicket.apache.org/apidocs/1.4/org/apache/wicket/markup/html/link/ExternalLink.html. 
Since it's a WebMarkupContainer underneath it will leave whatever is 
inside your a-tag intact.


Bas

Op 26-1-2011 22:38, Alexandros Karypidis schreef:

Hello,

I have the following case which I do not know how to handle with Wicket:

I have an element (specifically it is ana href=.../a  link) for which I
need to generate an attribute's value dynamically (specifically, I need to set
the href attribute at runtime), but I need to preserve the static content of
the page.

For example, my HTML file is:

a wicket:id=myTargetspan class=x/spansome static text/a

What do I have to do to produce:

a href=dynamically generated targetspan class=x/spansome static
text/a

So far, I've always replaced the entire content of an element with that
generated by some wicket component, but this is the first time I've needed to
filter part of the DOM and target something very specific in the middle of the
tree, without affecting the rest of the tree...




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