Hi Yeah I did have only the setModelObject() but it did not clear it that is why I added this. Maybe I have not used it correctly.Since you mentioned
'Note: componentInstance.setModelObject will call modelChanged from within if the model is actually changed' If the model is actually changed. That is what I am not sure, when does it get notified that a change has happened.?Setting of an entirely new instance in the model should do that isn't it. Please see code below. FYI: StudyModel is the bean that contains other objects. It is bound to a form using CPM. onNew(){ StudyModel studyModel; if(form != null && form.getModelObject() != null){ studyModel = form.getModelObject(); studyModel.setStudy(new Study());//a hibernate entity form.setModelObject(studyModel); form.modelChanged();//--> added this one to clear the data. form.clearInput(); } Thanks again Niv On Tue, Jul 27, 2010 at 3:05 PM, Martin Makundi < martin.maku...@koodaripalvelut.com> wrote: > Hi! > > > componentInstance.modelChanged(); > > componentInstance.setModelObject(selectedChoice); > > Note: componentInstance.setModelObject will call modelChanged from > within if the model is actually changed > > > 1. On the Form the user types in some information and then hits Save. > > 2. The form comes back with validation error messages. > > 3. The user now clicks on Cancel button to discard the form > > 4. The user clicks the New button and a form is loaded with the old data( > I > > had the data typed in the previous form repeated even though I cleared > the > > input form.clearInput.) > > 5. I add the form.modelChanged() and now it clears completely or takes > into > > account that its a fresh form. > > I could comment more if I saw the code. > > ** > Martin > > > > > > > > > > > On Sat, Jul 24, 2010 at 2:42 AM, Nivedan Nadaraj <shravann...@gmail.com > >wrote: > > > >> Cheers mate thanks for that. Only I thought it was one step closer to > >> building my own component and know the details of it. But yeah point > taken. > >> > >> Cheers > >> Nive > >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >