Issues with refreshing panel with form
Hi Wicket Users, I've just started to learn the Wicket by fixing some issues in our legacy backlog repository. Therefore, I need some clarification to manage my blockpoints. Having spent enough time to fix it by myself, I finally must turn out to this help. The weird problem could be described following: 1. A base form contains components and links to AbstractFormDialog(Jquery-ui) for user inputs. 2. When the formDialogA is submitted, some parent components are updated, some remain empty, as it is expected. 3. Another modal formDialogB is open and submitted and expecting components are not updated. When this procedure is done in swapped sequence - firstly formDialogB and then formDialogA is opened, everything works ok. Seems as if, the submitting formDialogA breaks the references for submission formDialogB. Could you please clarify me, what should be checked to avoid this problem? Thanks, M. Michal Zimen e-mail: michal.zi...@anasoft.com
Re: Issues with refreshing panel with form
I finally have found a hint what should be done to "properly" refresh components after nested form is submitted. In my onSubmit handler, I created a new component(panel) and set the model with values from the dialog. Then replaced it via component.replaceWith(newComponent). protected void onInitialize() { ... personModel = new Model(ComponentFactory.createPerson()); if (defaultPerson != null) personModel.setObject(defaultPerson.copy()); ... mandatePayerNamePersonPanel = new MandatePayerNamePersonEditPanel( "payerNamePersonPanel", new PropertyModel(personModel, "personName") ); Are there any other solutions to do it better? Maybe without replacing the components? Thanks, M. -Original Message- From: Martin Terra Sent: Tuesday, August 4, 2020 4:45 PM To: users@wicket.apache.org Subject: POSSIBLY SPOOFED: Re: Issues with refreshing panel with form Did you debug clearinput and model detach whether they occur expectedly? Snipplet is too small to see the big picture, and at the same time it seems too complex to get the big picture quickly from code (maybe you could share a 15 line pseudocode spec for the form, what it's intended to do)? ** Martin ti 4. elok. 2020 klo 15.43 Zimen, Michal (michal.zi...@anasoft.com) kirjoitti: > Hi, > > > > The dialogB(without nested form) of panelB uses this snippet to update > the models of the components in the root panel. > It works perfectly unless other nested form is submitted in advance. > >onClose( target) { > mandatePayerEditPanel.detachModels(); // this is the > reference to the root panels compoent, which needs to be updated. > // It’s passed via > constructor in the > final Person productIsPerson = (Person) > productIsClient.getParty(); > final PersonImpl person = (PersonImpl) > mandatePayerEditPanel.getPersonModel().getObject(); > > person.setPersonName(productIsPerson.getPersonName().copy()); > // sets the new value > > final IModel domesticAddressModel = > mandatePayerEditPanel.getAddressPersonPanel().getDomesticAddressModel(); > domesticAddressModel.detach(); > > > domesticAddressModel.setObject(productIsPerson.getContact().getAddress > ().copy()); > // sets the new value > > // now comes the stuff for refreshing components with ajax > response > target.add(componentsToRefreshOnVerificationFill); > List list = new ArrayList(); > > mandatePayerEditPanel.addComponentsToRefreshOnVerificationFill(list); > mandatePayerEditPanel.setOutputMarkupId(true); > mandatePayerEditPanel.setOutputMarkupPlaceholderTag(true); > mandatePayerEditPanel.markRendering(true); > mandatePayerEditPanel.setVisibilityAllowed(true); > mandatePayerEditPanel.modelChanged(); > mandatePayerEditPanel.configure(); > target.add(mandatePayerEditPanel); > } > > > > > > m. > > > > -Original Message----- > From: Martin Grigorov > Sent: Tuesday, August 4, 2020 2:25 PM > To: users@wicket.apache.org > Subject: Re: Issues with refreshing panel with form > > > > On Tue, Aug 4, 2020 at 2:53 PM Zimen, Michal <mailto:michal.zi...@anasoft.com>> > > wrote: > > > > > Thanks, > > > > > > Well, snippets from source code might come later. My concerns are, > > > that the issue I’m facing is related to this > > > https://issues.apache.org/jira/browse/WICKET-6041 > > > None weird logs have been found on both sides. > > > > > > DialogA with a nested form uses POST to update its stuff, but the > > > dialogB handle its work through GET only(no form submission). > > > > > > I was trying to catch the root form submission in form.onSubmit(), > > but > > > I found out, that this is not called, since the > > > wantSubmitOnNestedFormSubmit() returns false. > > > Therefore I conclude, that after POST request, other references > > among > > > components are broken. > > > > > > > What do you mean with this ? > > > > > > > > > > The question might be: How to "refresh" or keep these references > > after > > > nested form is submitted? > > > > > > Thanks a lot, > > > > > > > > > M. > > > > > > -Original Message- > > > From: Martin Grigorov > > mailto:mgrigo...@apache.org > >> > > > Sent
RE: Issues with refreshing panel with form
Thanks, Well, snippets from source code might come later. My concerns are, that the issue I’m facing is related to this https://issues.apache.org/jira/browse/WICKET-6041 None weird logs have been found on both sides. DialogA with a nested form uses POST to update its stuff, but the dialogB handle its work through GET only(no form submission). I was trying to catch the root form submission in form.onSubmit(), but I found out, that this is not called, since the wantSubmitOnNestedFormSubmit() returns false. Therefore I conclude, that after POST request, other references among components are broken. The question might be: How to "refresh" or keep these references after nested form is submitted? Thanks a lot, M. -Original Message- From: Martin Grigorov Sent: Tuesday, August 4, 2020 10:31 AM To: users@wicket.apache.org Subject: Re: Issues with refreshing panel with form Hi, On Mon, Aug 3, 2020 at 2:53 PM Zimen, Michal wrote: > Hi Wicket Users, > > >I've just started to learn the Wicket by fixing some issues in our > legacy backlog repository. > > Therefore, I need some clarification to manage my blockpoints. Having > spent enough time to fix it by myself, I finally must turn out to this > help. > > The weird problem could be described following: > > > 1. A base form contains components and links to > AbstractFormDialog(Jquery-ui) for user inputs. > 2. When the formDialogA is submitted, some parent components are > updated, some remain empty, as it is expected. > 3. Another modal formDialogB is open and submitted and expecting > components are not updated. > > When this procedure is done in swapped sequence - firstly formDialogB > and then formDialogA is opened, everything works ok. > > Seems as if, the submitting formDialogA breaks the references for > submission formDialogB. > > Could you please clarify me, what should be checked to avoid this problem? > I'd suggest these two things: 1) check for errors both in the server logs and in the browser 2) use a FeedbackPanel to show any validation errors in all Forms. I.e. if you override #onSubmit()/#onUpdate() then make sure you also override #onError() and if you use Ajax then add the FeedbackPanel to the AjaxRequestTarget > > Thanks, > >M. > > > > Michal Zimen > e-mail: michal.zi...@anasoft.com > >
RE: Issues with refreshing panel with form
Hi, The dialogB(without nested form) of panelB uses this snippet to update the models of the components in the root panel. It works perfectly unless other nested form is submitted in advance. onClose( target) { mandatePayerEditPanel.detachModels(); // this is the reference to the root panels compoent, which needs to be updated. // It’s passed via constructor in the final Person productIsPerson = (Person) productIsClient.getParty(); final PersonImpl person = (PersonImpl) mandatePayerEditPanel.getPersonModel().getObject(); person.setPersonName(productIsPerson.getPersonName().copy()); // sets the new value final IModel domesticAddressModel = mandatePayerEditPanel.getAddressPersonPanel().getDomesticAddressModel(); domesticAddressModel.detach(); domesticAddressModel.setObject(productIsPerson.getContact().getAddress().copy()); // sets the new value // now comes the stuff for refreshing components with ajax response target.add(componentsToRefreshOnVerificationFill); List list = new ArrayList(); mandatePayerEditPanel.addComponentsToRefreshOnVerificationFill(list); mandatePayerEditPanel.setOutputMarkupId(true); mandatePayerEditPanel.setOutputMarkupPlaceholderTag(true); mandatePayerEditPanel.markRendering(true); mandatePayerEditPanel.setVisibilityAllowed(true); mandatePayerEditPanel.modelChanged(); mandatePayerEditPanel.configure(); target.add(mandatePayerEditPanel); } m. -Original Message- From: Martin Grigorov Sent: Tuesday, August 4, 2020 2:25 PM To: users@wicket.apache.org Subject: Re: Issues with refreshing panel with form On Tue, Aug 4, 2020 at 2:53 PM Zimen, Michal mailto:michal.zi...@anasoft.com>> wrote: > Thanks, > > Well, snippets from source code might come later. My concerns are, > that the issue I’m facing is related to this > https://issues.apache.org/jira/browse/WICKET-6041 > None weird logs have been found on both sides. > > DialogA with a nested form uses POST to update its stuff, but the > dialogB handle its work through GET only(no form submission). > > I was trying to catch the root form submission in form.onSubmit(), but > I found out, that this is not called, since the > wantSubmitOnNestedFormSubmit() returns false. > Therefore I conclude, that after POST request, other references among > components are broken. > What do you mean with this ? > > The question might be: How to "refresh" or keep these references after > nested form is submitted? > > Thanks a lot, > > > M. > > -Original Message- > From: Martin Grigorov mailto:mgrigo...@apache.org>> > Sent: Tuesday, August 4, 2020 10:31 AM > To: users@wicket.apache.org<mailto:users@wicket.apache.org> > Subject: Re: Issues with refreshing panel with form > > Hi, > > On Mon, Aug 3, 2020 at 2:53 PM Zimen, Michal > mailto:michal.zi...@anasoft.com>> > wrote: > > > Hi Wicket Users, > > > > > >I've just started to learn the Wicket by fixing some issues in > > our legacy backlog repository. > > > > Therefore, I need some clarification to manage my blockpoints. > > Having spent enough time to fix it by myself, I finally must turn > > out to this help. > > > > The weird problem could be described following: > > > > > > 1. A base form contains components and links to > > AbstractFormDialog(Jquery-ui) for user inputs. > > 2. When the formDialogA is submitted, some parent components are > > updated, some remain empty, as it is expected. > > 3. Another modal formDialogB is open and submitted and expecting > > components are not updated. > > > > When this procedure is done in swapped sequence - firstly > > formDialogB and then formDialogA is opened, everything works ok. > > > > Seems as if, the submitting formDialogA breaks the references for > > submission formDialogB. > > > > Could you please clarify me, what should be checked to avoid this > problem? > > > > I'd suggest these two things: > 1) check for errors both in the server logs and in the browser > 2) use a FeedbackPanel to show any validation errors in all Forms. > I.e. if you override #onSubmit()/#onUpdate() then make sure you also > override > #onError() and if you use Ajax then add the FeedbackPanel to the > AjaxRequestTarget > > > > > > Thanks, > > > >M. > > > > > > > > Michal Zimen > > e-mail: michal.zi...@anasoft.com<mailto:michal.zi...@anasoft.com> > > > > >