Perhaps put logic in onsubmit to check for required country? On Mar 18, 2010 6:45 PM, "David Chang" <david_q_zh...@yahoo.com> wrote:
Martin, the following is the code for the country dropdown list, which can control the state dropdown list. The problem is that when the country list's value is switched to "null" from a selected country (say, USA), then the state dropdown list does not update. In addition, Wicket in the backend has the following message. Another puzzling thing to me is that my FeedbackPanel is there as defined below. ------- message -------- 18:38:20,890 WARN WebSession:193 - Component-targetted feedback message was left unrendered. This could be because you are missing a FeedbackPanel on the page. Message: [FeedbackMessage message = "Field 'Country' is required.", reporter = country, level = ERROR] ------- dropdown list code ------- List<Country> countryList = objectService.findAllCountries(); DropDownChoice countryDDC = new DropDownChoice("country", countryList, new ChoiceRenderer("name", "id") ); countryDDC.setRequired(true); countryDDC.add(new AjaxFormComponentUpdatingBehavior("onchange") { protected void onUpdate(AjaxRequestTarget target) { if (target != null) { MyUser u = f.getModelObject(); u.setState(null); DropDownChoice stateDDC = (DropDownChoice) f.get("state"); stateDDC.setChoices(objectService.findStatesByCountry(f.getModelObject().getCountry())); target.addComponent(stateDDC); } } }); f.add(new FormComponentFeedbackBorder("borderCountry").add(countryDDC)); ------ FeedbackPanel code -------- add(new FeedbackPanel("feedbackHolder") { @Override public boolean isVisible() { return true;//anyMessage(); } }.setOutputMarkupId(true)); --- On Thu, 3/18/10, Martin Makundi <martin.maku...@koodaripalvelut.com> wrote: > From: ... > Date: Thursday, March 18, 2010, 11:50 AM > Code? > > 2010/3/18 David Chang <david_q_zh...@yahoo.com>: > > Martin, thanks for chimining in. I...