That was exactly it. Thanks for that explanation! Cheers, Tim
Jeremy Thomerson-5 wrote: > > It doesn't have to do with your html input vs. button. It's because > default > form processing is turned off, the form model doesn't fire that it was > changed, so the model doesn't go back to your getName() method to get it's > value. > > You can add this in your button onSubmit: > getForm().modelChanged(); > > > > -- > Jeremy Thomerson > http://www.wickettraining.com > > > On Wed, Dec 3, 2008 at 6:26 PM, tim532 <[EMAIL PROTECTED]> wrote: > >> >> 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] >> >> > > -- View this message in context: http://www.nabble.com/Updating-Form-TextField-Value-tp20824843p20825050.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]
