Hi Carlos,

It is a bug, but it is in your application ;-)

You need different HTML elements depending on a condition, so you cannot
use just <img> or <span> without some extra logic.

One way to fix this is to use a Fragment or a Panel for each case, i.e. a
Fragment for the image and another for the Label. Isis itself uses this
approach at
https://github.com/apache/isis/blob/db8641628b1aa0f9e69dcd84754df3bc79ef5a4b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/scalars/ScalarPanelTextFieldAbstract.html

Another way is to manipulate the component's tag on the fly. Use <span> in
your markup and :
new Image(...) {
  @Override protected void onComponentTag(ComponentTag tag) {
     super.onComponentTag(tag);
     tag.setName("img");  // this is the magic !
  }
}

Greetings to the tellmeGen team!


Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Thu, Nov 5, 2015 at 1:41 PM, carlos.sanchez <[email protected]
> wrote:

> Hello guys!!
>
> I hope is going good out there :) I was wondering a little question for
> you:
>
> I am using an <img/> tag in the html file with a wicket id and in the java
> code I have an if/else that if is "if" makes new Image(X, X); and if is
> "else" makes a new Label(X, X);
>
> So, when I use in the html file <img/> tag it works with a Label or Image
> (from java code) and when I use <span> tag it doesn't works with the image
> created in the java code. I don't know if is a bug or what. I just want to
> know it!
>
>
> Thanks very much!
>
> Regards,
> Carlos.
>

Reply via email to