this.getForm().getModelObject() returns the model of another form page

2009-09-21 Thread Charles Moulliard
I have created a form class which is used by a class extending
webpage. When I call the following method in the onSubmit method of
the form button I receive the model attached to another form page (=
requestFormModel) and not (= requestMessageFormModel).

Is there any restrictions/limitations using this method call :
this.getForm().getModelObject()

Here is the code of my RequestMessageForm()

public class RequestMessageForm extends Form {

private static final long serialVersionUID = 1L;

public RequestMessageForm(String name) {

super(name, new CompoundPropertyModel(new RequestMessageFormModel()));

// Add textFields
add(textfieldRequestMessageId);
add(textfieldFromDate);
add(textfieldToDate);

// Add drop down choice
add(dropDownChoiceStatus);
add(dropDownChoiceType);

// Add buttons
add(new Button(bSearchCriteriaRequestMessage) {
@Override
public void onSubmit() {
Log.info(Model received RM :  +
this.getForm().getModelObject()); // Here I receive the model
requestFormModel and not requestMessageFormModel
setResponsePage(new 
RequestMessagePage((RequestMessageFormModel)
this.getForm().getModelObject()));
}
});

}

Remark : The class RequestMessageFormModel is a simple POJO extending
the class CommonFormModel (which is also a POJO). The class
RequestFormModel used by the other page extends CommonFormModel )

Regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*
blog : http://cmoulliard.blogspot.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: this.getForm().getModelObject() returns the model of another form page

2009-09-21 Thread Johan Compagner
i dont see how that can happen if i look at your code.

is  RequestMessageForm .this != this.getForm() ??

do you nest forms?

johan


On Mon, Sep 21, 2009 at 11:38, Charles Moulliard cmoulli...@gmail.comwrote:

 I have created a form class which is used by a class extending
 webpage. When I call the following method in the onSubmit method of
 the form button I receive the model attached to another form page (=
 requestFormModel) and not (= requestMessageFormModel).

 Is there any restrictions/limitations using this method call :
 this.getForm().getModelObject()

 Here is the code of my RequestMessageForm()

 public class RequestMessageForm extends Form {

private static final long serialVersionUID = 1L;

public RequestMessageForm(String name) {

super(name, new CompoundPropertyModel(new
 RequestMessageFormModel()));

// Add textFields
add(textfieldRequestMessageId);
add(textfieldFromDate);
add(textfieldToDate);

// Add drop down choice
add(dropDownChoiceStatus);
add(dropDownChoiceType);

// Add buttons
add(new Button(bSearchCriteriaRequestMessage) {
@Override
public void onSubmit() {
Log.info(Model received RM :  +
 this.getForm().getModelObject()); // Here I receive the model
 requestFormModel and not requestMessageFormModel
setResponsePage(new
 RequestMessagePage((RequestMessageFormModel)
 this.getForm().getModelObject()));
}
});

}

 Remark : The class RequestMessageFormModel is a simple POJO extending
 the class CommonFormModel (which is also a POJO). The class
 RequestFormModel used by the other page extends CommonFormModel )

 Regards,

 Charles Moulliard
 Senior Enterprise Architect
 Apache Camel Committer

 *
 blog : http://cmoulliard.blogspot.com

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org