Hello, i'm experiencing some issues with ending of target's lifecycle.

On my page I have few Panels, where user is entering data. One of them has
ListView, with TextField below and "Add" button. I've implemented, that
TextField stuff goes to ListView even "Add" button is not pressed (with
onBlur event and without updating ListView). Add button has
"target.addComponent(rowPanel);", where rowPanel is the MarkupContainer,
which holds ListView. 

Also, at bottom of the page I have 3 links: save as draft, publish, cancel.
Last two have popup windows (ModalWindow). Looks like that:

add(new CustomAjaxSubmitLink(LinkNames.submitLink.toString(), form,
                RoleController.CONTROLLER.getAccessController()) {
            @Override
            protected void onSubmit(AjaxRequestTarget target, Form form) {
                target.addComponent(form);
                publishPopup.show(target);
            }
        });

publishPopup.setWindowClosedCallback(new ModalWindow.WindowClosedCallback()
{
            public void onClose(AjaxRequestTarget target) {
                if (ApplicationInsertActionPanel.this.getSelectedAction() !=
null
                        &&
ApplicationInsertActionPanel.this.getSelectedAction().equals(Action.CONFIRM))
{
                    insert(appl,
                            true,
                            form,
                            target,
                            new MainMenu(ApplicationInsertActionPanel.this
                                   
.getString("accept.application.publish.success.message")), trail, checkbox);
                }

            }
        });

But the draft link haven't got this popup:
add(new SecuredAjaxSubmitLink(LinkNames.savelaterLink.toString(), form,
                RoleController.CONTROLLER.getAccessController()) {
            @Override
            public void onSubmit(AjaxRequestTarget target, Form form) {
                target.addComponent(form);
                insert(appl, false, form, target, new
MainMenu(getString("accept.application.draft.success.message")), trail,
checkbox);
            }

The problem is, that when business layer validation is failing, all
validation failed fields should be highlighted with CSS. In popup window,
form is updated before calling ModalWindow. Everything is perfect. When i'm
pressing draft link - everything works fine, except my ListView. If I'm
leaving my input in TextField below, it is added to ListView, but isn't
highlighted. Error message is added to default feedbackPanel. Even if i'm
adding 
@Override
            protected void onError(final AjaxRequestTarget target, Form<?>
form) {
                super.onError(target, form);
                target.addComponent(form);
}
to my draft link. It is still not fully updated.

I suppose it is because lifecycle of target is ended before ModalWindow is
shown on page. But as draft link doesn't have this ModalWindow, it isn't
updating correctly. So I'm thinking how I can end target's lifecycle before
stuff goes to business and then create new one and send everything to
business. Not sure if it is correct approach, but still got no choices. 

Thanks in advance!

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Apache-wicket-how-to-end-target-s-lifecycle-explicitly-tp4649574.html
Sent from the Users forum mailing list archive at Nabble.com.

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

Reply via email to