don't know if i totally understood the setting of your example, but your edit button shouldn't submit/post the form, eg. just use a Link attached to an <input type="button"> tag instead of a Button.
Gerolf On Wed, Dec 10, 2008 at 1:11 PM, Rutger Jansen <[EMAIL PROTECTED]> wrote: > Well this is of course a simple example. > In my case I have an administration page with a list of domain > objects, lets say cheeses (how did I come up with that idea?). > > On the same page I have a form with all fields of the cheese object > (name and kiloPrice for example). Behind each cheese in the list there > is an 'edit' button which will set that specific cheese object as a > the current model object in the form, which results in the name and > kiloPrice field in the form being filled with the values of the > cheese. > > If then, for some reason the validation of a form post fails (the > price is too high for this Gouda), and I (as an end user) decide to > skip editing this Gouda cheese and press the edit button of the > Cheddar cheese, the form will not be updated with the name and price > of the Cheddar. The values of the Gouda remain. Even though the > current object in the model was updated to Cheddar. > > When I now press the submit button again (after putting a correct > price in the field), the Cheddar object is updated with the values of > the Gouda (which were still in the formfields). > > I can make a bigger example like this if needed. > > > On 12/10/08, Martijn Dashorst <[EMAIL PROTECTED]> wrote: > > Why on earth would you want to update a model value when there's a > > validation error in the input? That is the whole point of validation! > > > > Martijn > > > > On Wed, Dec 10, 2008 at 10:44 AM, Rutger Jansen <[EMAIL PROTECTED]> > wrote: > >> Hi, > >> > >> I have a strange situation in the admin part of my application which I > >> have reproduced in this tiny code example. > >> > >> In this example I can load a value in the textfield by clicking the > >> link (which also increases the number to show that the link works ok). > >> I can post the form without problems and load the value again. > >> But when a validation error occurs (in this case when the posted value > >> is too long), the field will not be updated after pressing the link > >> (even though the log shows that the link is clicked), unless I post > >> the form again without validation errors. > >> > >> Am I forgetting something here? > >> > >> > >> Rutger > >> > >> > >> --- Example page class--- > >> public class Example extends WebPage { > >> > >> private String value; > >> private int valueVersion = 1; > >> > >> public Example() { > >> Form form = new Form("form"); > >> > >> TextField textfield = new TextField("textfield", new > >> PropertyModel(Example.this, "value")); > >> textfield.add(StringValidator.maximumLength(15)); > >> form.add(textfield); > >> > >> add(form); > >> add(new FeedbackPanel("feedback")); > >> > >> add(new Link("link"){ > >> @Override > >> public void onClick() { > >> value = "This is a test" + valueVersion++; > >> } > >> }); > >> } > >> } > >> > >> --- Example html --- > >> <html xmlns="http://www.w3.org/1999/xhtml" > >> xmlns:wicket="http://wicket.sourceforge.net/"> > >> <head></head> > >> <body> > >> <div wicket:id="feedback" /> > >> > >> <form wicket:id="form"> > >> <input type="text" wicket:id="textfield"/> > >> <input type="submit" /> > >> </form> > >> > >> <p><a href="#" wicket:id="link">Load form value</a></p> > >> </body> > >> </html> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > > > > > > > > -- > > Become a Wicket expert, learn from the best: http://wicketinaction.com > > Apache Wicket 1.3.4 is released > > Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3. > > > > --------------------------------------------------------------------- > > 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] > >