* Pieter Cogghe:
> 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?

A Panel would be nice, or otherwise there's a dirty hack to
directly write tags into the response.
-- 
     Jean-Baptiste Quenot
aka  John Banana   Qwerty
http://caraldi.com/jbq/

-------------------------------------------------------------------------
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