I have a panel which has a form. The corresponding html has a input element of type 'submit'. When clicked the form's onsubmit() method is triggered as expected. If i have a business logic exception (eg dependent fields were not completed) then I call the relevant component's error() method. The current page is then reloaded. But my error panel does not display anything. Putting breakpoints in my code revealed that my panel's onBeforeRender() was being called twice! Ie the page was being rendered twice! Once via WebRequestCycle.redirectTo() and once via PageRequestTarget.respond().
The 1st time around, my form has error messages attached, but the 2nd time they are null. Here is my code: registrationForm = new Form("registrationForm", new CompoundPropertyModel(resume)) { @Override protected void onBeforeRender() { // TODO Auto-generated method stub super.onBeforeRender(); LOGGER.info("rendering resume panel..."); } @Override protected void onSubmit() { if (resume.isJob1() || resume.isJob2() || resume.isJob3()) { this.info("thanks for your resume"); setResponsePage(BrandedAppHomePage.class); /* need to remember validation errors from this request so that the 2nd (AJAX) * request can add them back against each component */ //collectValidationMessages(this); this.error("Please select a suitable file to upload"); } else { this.error("Please make a job selection"); } } /* called when there's a form validaton error */ @Override protected void onError() { LOGGER.warn("in onError..."); } }; add(registrationForm); add(new FeedbackLabel("validation_form", registrationForm)); job1CheckBox = new CheckBox("job1Choice", new PropertyModel(resume, "job1")); job2CheckBox = new CheckBox("job2Choice", new PropertyModel(resume, "job2")); job3CheckBox = new CheckBox("job3Choice", new PropertyModel(resume, "job3")); registrationForm.add(job1CheckBox); registrationForm.add(job2CheckBox); registrationForm.add(job3CheckBox); } Could this be somehow facebook-related? I dont' think the 2nd PageRequestTarget.respond() should be called. I don't see it being called in non-facebook form submits... Thanks Jeremy