thank you
> From: [EMAIL PROTECTED] > To: users@wicket.apache.org > Subject: Re: multiple DropDownChoice > Date: Sun, 20 Apr 2008 19:00:28 +0200 > > Am Sonntag, 20. April 2008 18:19:33 schrieb i ii: > > is example available for multiple DropDownChoice where one menu changes > > value in other? i look at http://wicketstuff.org/wicket13/ but see no > > example > You could do this in your model. Both ddcs could point to same business > model. > If a selection changes the model could switch the other attribute. After you > reloaded the ddcs - the value should be updated. > > MyModel extends MyBusinessModel { > List<?> values1 = null; > Object selectedValue1 = null; > List<?> values2 = null; > Object selectedValue2 = null; > > List<?> getValues1() {return values1;} > MyModel setValues1(List<?> a) {values1=a;} > Object getSelectedValue1() { return selectedValue1;} > MyModel setSelectedValue1(Object a) { > selectedValue1 = a; > if (a.equals(aObject)) { > setSelectedValue2(getValues2().get(0)); > } > } > > List<?> getValues2() {return values2;} > MyModel setValues2(List<?> a) {values2=a;} > Object getSelectedValue2() { return selectedValue2;} > MyModel setSelectedValue2(Object a) { > selectedValue2 = a; > if (a.equals(aObject)) { > setSelectedValue1(getValues1().get(0)); > } > } > } > > MyPanel extends Panel { > MyPanel(String id, IModel m) { > super(id, m); > Form f = new Form("theForm"); > add(f); > f.add(new DDC("val1", > new PropertyModel(m, "selectedValue1"), > new PropertyModel(m, "values1"); > f.add(new DDC("val2", > new PropertyModel(m, "selectedValue2"), > new PropertyModel(m, "values2"); > // ... ajax update behavior - examples in wiki > } > } > > MyPage extends WebPage { > MyPage() { > MyModel m = createMyModelWithSomeValues(); > CompoundPropertyModel c = new CompoundPropertyModel(m); > add(new MyPanel("myPanel", c); > } > } > > Something like that. > HTH > Per > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] >