Well ok, I'll give the Panel solution a try. In the panel I will have a 
FormGroup Border and inside that there's my input/textfield. Only thing that 
still worries me:
user creates the TextField in Java code with wicket:id that he has in it's 
markup file. This wicket:id can't be changed afterwards (final). But in 
MyFormGroupPanel I need markup for the input, and this markup needs an id. Hm, 
maybe I'll look into some repeater solution for that problem ...

Tom


> Gesendet: Dienstag, 03. September 2019 um 09:35 Uhr
> Von: "Martin Grigorov" <[email protected]>
> An: "[email protected]" <[email protected]>
> Betreff: Re: Wrapping a FormComponent with a Border
>
> On Tue, Sep 3, 2019 at 10:30 AM "Tom Götz" <[email protected]> wrote:
> 
> > Thanks Martin, I will look into that. But won't it be a problem that I
> > will add the <input/> / TextField to the Border without having any markup
> > inside the Border? Won't I need my <input/> markup inside the border
> > <div/>s?
> >
> 
> right! it is a Border, not a Panel (
> https://github.com/l0rdn1kk0n/wicket-bootstrap/blob/wicket-8.x/bootstrap-core/src/main/java/de/agilecoders/wicket/core/markup/html/bootstrap/form/FormGroup.html#L9
> )
> I think it would be easier if you roll MyFormGroupPanel instead of using a
> Border.
> If you decide to stick with FormGroup then you will need to override
> onComponentTagBody() too
> 
> 
> >
> > Tom
> >
> >
> > > Gesendet: Dienstag, 03. September 2019 um 09:22 Uhr
> > > Von: "Martin Grigorov" <[email protected]>
> > > An: "[email protected]" <[email protected]>
> > > Betreff: Re: Re: Wrapping a FormComponent with a Border
> > >
> > > Hi Tom,
> > >
> > > Since your "user" is going to add a TextField in the Java code then I
> > > assume (s)he is going to add <input wicket:id="..."/> in the markup.
> > > Your IComponentInitializationListener will replace all components of type
> > > TextField which do not have FormGroup as a parent with a MyFormGroup.
> > >
> > > public class MyFormGroup extends FormGroup {
> > >    // constructor(s)
> > >
> > >   @Override
> > >   public void onComponentTag(ComponentTag tag) {
> > >     super(tag);
> > >     tag.setName("div");  // this modifies <input> to <div>
> > >   }
> > > }
> > >
> > > I am not sure, but you may also need to expand the tag from OpenClose
> > (i.e.
> > > <input/>) to open+close (i.e. <div></div>). See
> > ComponentTag#isOpenClose()
> > > and Component#afterRender();
> > >
> > > On Tue, Sep 3, 2019 at 10:09 AM "Tom Götz" <[email protected]> wrote:
> > >
> > > > Martin,
> > > >
> > > > maybe you could point me into the right direction concerning the markup
> > > > manipulation part?
> > > >
> > > > This is what I got in my HTML:
> > > >
> > > > <form wicket:id="form">
> > > >   <input wicket:id="input" type="text" />
> > > > </form>
> > > >
> > > > I guess this is what I need for effectively replacing the input with a
> > > > FormGroup border:
> > > >
> > > > <form wicket:id="form">
> > > >   <div wicket:id="border">
> > > >     <input wicket:id="input" type="text" />
> > > >   </div>
> > > > </form>
> > > >
> > > > Where would be the best place in the code to start looking?
> > > >
> > > > Thanks in advance
> > > > Tom


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to