I think you'll want to use the <button> tag rather than the <input type="submit> for the "changeName" button.
-----Original Message----- From: tim532 [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 03, 2008 4:27 PM To: [email protected] Subject: Updating Form TextField Value Hopefully this is a simple question with a simple answer... For reasons I can't quite grasp yet, the button to changeName doesn't change the textfield value when I click it. However, the submit button does work to change the value of the textfield, and setting the initial default value of the textfield works too. Can someone enlighten this new Wicket developer? I've tried to search for a similar question but it seems too basic.. The form: <form wicket:id="editForm"> <input type="text" id="name" wicket:id="name" /> <input type="submit" wicket:id="changeName" value="changeName" /> <input type="submit" wicket:id="saveButton" value="save" /> </form> With code as such: public class SimpleExample extends BasePage{ private String name = "defaultName"; public String getName() {return name;} public void setName(String name) { this.name = name;} public SimpleExample() { Form editForm = new Form("editForm", new CompoundPropertyModel(this)) { public void onSubmit() { name = "afterSubmit"; } }; Button b = new Button("changeName") { public void onSubmit() { SimpleExample.this.name = "testName"; } }.setDefaultFormProcessing(false); TextField txtCode = new TextField("name"); editForm.add(b); editForm.add(txtCode); editForm.add(new Button("saveButton")); add(editForm); } } Thanks, Tim -- View this message in context: http://www.nabble.com/Updating-Form-TextField-Value-tp20824843p20824843. 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
