How should I set up my model for the following situation. I have a form
with a ListChoice and a TextField. The TextField needs to access a
property of the object selected of the ListChoice. I have it all working
using a ValueMap, but that seems like overkill to use a ValueMap for one
object. Here is how I have it:
super(new CompoundPropertyModel<ValueMap>(new ValueMap()));
ListChoice<Vendor> vendorListChoice = new ListChoice<Vendor>("vendor",
new LoadableDetachableModel<List<Vendor>>(){...}, new
IChoiceRenderer<Vendor>(){...});
TextField<String> accountNumberField = new
TextField<String>("vendor.accountNumber");
I thought I could do something like this:
super(new CompoundPropertyModel<Vendor>(new Vendor()));
The ListChoice is the same as above and the TextField like this:
TextField<String> accountNumberField = new
TextField<String>("accountNumber");
The problem with this is that the ListChoice is trying to set a property
on the model named vendor when I realy want the selected ListChoice
vendor object be the model object and have the TextField access the
accountNumber property of the ListChoice vendor.
How should I set up my model to deal with this type of situation or is a
ValueMap the best way?
Thanks,
Warren
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]