Thanks for the responses, I ran into trouble when using a panel. Somehow I can't get my model property associated with the textfield in the panel.
class MyModel { (...) public String getText(){ return text; } (...) } My panel (simplified) class MyPanel extends Panel{ public MyPanel(String id, IModel fieldModel){ super(id); add(new TextField("panelField", fieldModel)); (...) } } then I add the panel to the form (which has the MyModel as a CompoundPropertyModel): add(new MyPanel("textPanel", new PropertyModel(this.getModelObject(), "text")) So the textfield within the panel should be associated with the "text" property of the compoundProperty model (MyModel.getText). Somehow I feel I get something seriously wrong here. Thanks, Pieter 2007/6/13, Jean-Baptiste Quenot <[EMAIL PROTECTED]>: > * 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 > -- 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