im thinking it might be too late at that point to register the messages because the feedback panel might have already rendered...
perhaps instead of using a loadable detachable model you do something like this: class mypage { private List result; onbeforerender() { try { result=populatelist(); } catch (exception e) { error("foo"); } super.onbeforerender(); } ondetach() { result=null; super.ondetach(); } .. add(new listview("foo", new propertymodel(this, "result")); } -igor On Wed, Mar 19, 2008 at 2:04 PM, Matthew Young <[EMAIL PROTECTED]> wrote: > I register an error to the page in the model but the feedback message > doesn't show in FeedbackPanel. Only the error message register in > onSubmit() event handler shows. Please have a look. Thanks! > > HomePage.html: > > <html> > <head></head> > <span wicket:id="message">message will be here</span> > <form wicket:id="form"> > <input type="text" wicket:id="word"/> > <input type="submit" value="Enter" wicket:id="submitButton"/> > </form> > <span wicket:id="feedback">FEEDBACK</span> > </html> > > > HomePage.java > > import ... > > public class HomePage extends WebPage { private static final long > serialVersionUID = 1L; > > private String word; > > public HomePage(final PageParameters parameters) { > > add(new > FeedbackPanel("feedback").setOutputMarkupPlaceholderTag(true)); > // if the word 'blowup' is entered, this model register a error > message to the page > IModel model = new Model() { private static final long > serialVersionUID = 1L; > @Override public Object getObject() { > if (word != null && word.equals("blowup")) { > word = "-b-l-o-w-u-p-"; > HomePage.this.fatal("This message is from model."); > return "BAD THING HAPPENED IN MODEL"; > } else { > return "The word is: \"" + (word == null ? " n u l l " : > word) + "\""; > } > } > }; > add(new Label("message", model).setOutputMarkupId(true)); > Form form = new Form("form", new CompoundPropertyModel(this)); > add(form); > form.add(new TextField("word").setRequired(true)); > > AjaxFallbackButton submitButton = new > AjaxFallbackButton("submitButton", form) { > private static final long serialVersionUID = 1L; > @Override protected void onSubmit(AjaxRequestTarget target, Form > f) { > if (word != null && word.equals("blowup")) { > HomePage.this.error("This message is from onSubmit. > There should also be a message from model"); > } > if (target != null) { > target.addComponent(HomePage.this.get("feedback")); > target.addComponent(HomePage.this.get("message")); > } > } > > @Override protected void onError(AjaxRequestTarget target, Form > f) { > target.addComponent(HomePage.this.get("feedback")); > // show updated error feedback > } > }; > form.add(submitButton); > } > } > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]