I've found SimpleFormComponentLabel in the api, which wasn't listed in
the component reference. With this I get (more or less) what I want.

2007/6/12, Pieter Cogghe <[EMAIL PROTECTED]>:
> Hi,
>
> (I'm new to Wicket and relatively new to Java so beware of stupid
> questions and bad code)
> I've got a form with a text input. I want it rendered like this:
>
> <form (...)>
> (...)
> <p>
>   <label for="input_name">Name</label>
>   <input type="text" id="input_name" name="name" />
> </p>
> (...)
> </form>
>
> I want to write my own component, so I only have to write this
> template html-code:
>
> <form wicket:id="input">
> (...)
> <p>
>   <input type="text" wicket:id="name"  />
> </p>
> (...)
> </form>
>
> The java code to add this to a page (TextFieldWithIdLabel of the
> custom component)
>
> add(new TextFieldWithIdLabel("name").setLabel(new Model("Name")));
>
>
> I'm not sure how to this, I started by extending TextField and
> overwriting onTagComponent like this:
>
> protected void onComponentTag(ComponentTag tag){
>         setOutputMarkupId(true);
>         super.onComponentTag(tag)
> }
>
> This works fine for the input-id, however I'm not sure how I can add
> the label tag in front of it. Maybe I should write a custom panel?
>
> Thanks a lot,
>
> Pieter
>
>
>
>
>
> --
> Pieter Cogghe
> Ganzendries 186
> 9000 Gent
> 0487 10 14 21
>


-- 
Pieter Cogghe
Ganzendries 186
9000 Gent
0487 10 14 21

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to