see the BoundCompoundPropertyModel
there you can bound a property _expression_ to a textfield.

something like this;

IModel model = new BoundCompoundPropertyModel(myObject
);
add(new MyForm("MyForm", model));
......
and then in MyForm:

TextField tf = new TextField("total") 

add(tf); // This calls getTotal() in my object through OGNL

model.bind(tf,"property")

johan



On 1/3/06, Thomas J du Plessis <[EMAIL PROTECTED]> wrote:
Hi all
I have a Form to which I pass a CompoundPropertyModel containing an object. I then rely on Wicket's 'magical' ability to map object fields to wicket components.  Like this:

IModel model = new CompoundPropertyModel(myObject);
add(new MyForm("MyForm", model));
......
and then in MyForm:
add(new TextField("total")); // This calls getTotal() in my object through OGNL

This is all brilliant and working beautifully.  However I'd like to be ale to add a wicket component for which the id annot be mapped to an accessor in my model object. Eg:
in MyForm:
add(new TextField("calculatedValue"));  // There is no getCalculatedValue() in myObject

When I try this, I get an OGNL exeption.  So the problem is that I seem to be unable to use 'non-mapped' wicket id's when I'm using CompoundPropertyModel.  Is this true?

Can anyone tell me how I can achieve this?

Much appreciated,
Thomas


Reply via email to