Here is how I would do it: HTML: <table> <tr wicket:id="tableRow"> <td> . <input wicket:id="textInput" type="text" /> </td> </tr> </table>
Model Object: // this is a simple object I am going to use for my model. // It holds the value the user will enter in the textbox and // a primary key value, so I know how to update my database // when I save. private class RandomObject implements Serializable{ private static final long serialVersionUID = 1L; private String textValue; private int pkValue; public String getTextValue() { return textValue; } public void setTextValue(String textValue) { this.textValue = textValue; } public int getPkValue() { return pkValue; } public void setPkValue(int pkValue) { this.pkValue = pkValue; } private RandomObject(String textValue, int pkValue){ this.textValue = textValue; this.pkValue = pkValue; } } Java for the page layout: // Create objects however...here I make 3 // Store the list somewhere so you can loop through it and save each // key word on submit...I did not add the submit code here, but it is basic enough ArrayList<RandomObject> myArray = new ArrayList<RandomObject>(); myArray.add(new RandomObject(null, 1)); myArray.add(new RandomObject(null, 2)); myArray.add(new RandomObject(null, 3)); ListView theView = new ListView("tableRow", myArray){ private static final long serialVersionUID = 1L; public void populateItem(final ListItem listItem){ final RandomObject item = (RandomObject)listItem.getModelObject(); listItem.add(new Label("numberLabel", new Model(String.valueOf(listItem.getIndex() + 1)))); // Could add validation here if needed. listItem.add(new TextField("textInput", new PropertyModel(item, "textValue"))); } }; add(theView); Mathias P.W Nilsson wrote: > > Hi! > > In my application a user should be able to connect keywords to a > datasheet. > > When clicking the link add keywords 10-20 textfields should appear and the > user can enter data to > the fields. > > #1 > textField > #2 > textfield > ...... > > > How can I handle this like an array in wicket? I do not want to add 20 > textfields by hand. > -- View this message in context: http://www.nabble.com/Multiple-TextField-in-ListView-tp16492002p16496226.html Sent from the Wicket - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]