If you create a new Poll object, there is no magic that will bind that
to your form instead of the Poll object you wrapped in the
CompoundPropertyModel.
You could put the poll object as a local field member in the class, and
use PropertyModel(poll, "property-expression") for the fields instead.
That way you can swap out the poll-object and still keep the form in sync.
Alternatively you can apply the new Poll object to the form by doing:
form.setModel(new CompoundPropertyModel(newPollObject)) after you create
the new one.
-- Edvin
itayh skrev:
Hi,
I am creating a form in the next format:
private abstract class EditForm extends Form{
public EditForm(String id, Poll poll) {
/*
* We wrap the poll bean with a CompoundPropertyModel, this
allows
* us to easily connect form components to the bean properties
* (component id is used as the property expression)
*/
super(id, new CompoundPropertyModel(poll));
....
}
}
My page has also some buttons in different forms that do all kind of things.
My problem begin when I create new Poll object (so the poll is empty) and
fill the fields of the poll, but before saving it I press on one of the
other buttons. It is rendering the page again so all the data that I enter
is lost.
Same problem occur when I edit poll and before saving it I press on one of
the other buttons. It is rendering the page again so all the data that I
change is lost.
Any idea will be appreciate.
Thanks,
Itay
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]