A beanA = new A(); TextField aName = new TextField("name", new PropertyModel(beanA, "name")); Select aId = new Select("id", new PropertyModel(beanA, "b_id")); SelectOptions options = new SelectOptions("options", aListOfAllIdsInB, rendererIdToDisplay); aId.add(options);
something like this should do it On Fri, Apr 13, 2012 at 5:07 AM, William Speirs <wspe...@apache.org> wrote: > I have 2 JavaBeans A & B. A has 2 fields: String name, Integer b_id. B has > 2 fields: Integer id, String display. > > I have a list of beans for B: > 1, "foo" > 2, "bar" > > I have a single A bean, where its b_id corresponds to an id in bean B > (basically the beans represent 2 tables in a DB with the ids as references > to each other). I want to create a form to edit bean A which includes a > drop-down for all the possible options for bean B. The one hitch is that I > want groups for my drop-down, so I believe I'm forced to use Select & > SelectOption with the appropriate mark-up in HTML. > > I have the form completed and working for changing A's name field, but I > cannot figure out how to link the drop-down which displays all my options > for bean B to A's b_id field. I'm using a PropertyModel to modify A's name > field, and but I missing how to link A's b_id to the id from B. Also, my > <select> has values like option3, option4, option5... I would think I'd > need these to be B's id field values for this to work. > > Any help in the right direction would be greatly appreciated. I'm very > close, just missing this one link between my two models. > > Thanks in advance... > > Bill- -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org