You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Paul Bors <pa...@bors.ws> on 2012/11/07 16:34:38 UTC
RE: How to call a ModalWindow's close callback?
Sounds like you have nested forms and from last time I checked you cannot
submit the outer form from within an inner form. Either get rid of the inner
form so any button will perform the form submission or share a method to
refresh the page and call it from two places.
Wither way you should check into nested forms:
https://cwiki.apache.org/WICKET/nested-forms.html
~ Thank you,
Paul Bors
-----Original Message-----
From: rudi [mailto:rudi_mail90@yahoo.com]
Sent: Tuesday, October 30, 2012 4:58 AM
To: users@wicket.apache.org
Subject: How to call a ModalWindow's close callback?
Hi all,
I have a ModalWindow, which when closed should update a panel (in this case,
happens to be the parent of the ModalWindow) :
final ChangePasswordModal changePasswordModal = new
ChangePasswordModal("changePasswordModal", person,
InputEditCustomerSysPanel.this);
changePasswordModal.setCloseButtonCallback(new CloseButtonCallback() {
@Override
public boolean onCloseButtonClicked(AjaxRequestTarget target) {
info("close button");
target.add(InputEditCustomerSysPanel.this);
return true;
}
});
add(changePasswordModal);
This works when the close button is clicked by the user. However, the
primary use case is the modal will be closed by a an AjaxButton inside a
form inside a panel inside the modal:
AjaxButton submitBtn = new AjaxButton("submitBtn") {
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
// info("Updating password for " +
person.getObject().getId() + " to be
" + passwordField.getModelObject().toString());
log.info("Updating password for {} to be {}",
person.getObject().getId(), passwordField.getModelObject());
person.getObject().setPassword(LdapUtils.encodeSsha(passwordField.getModelOb
ject()));
modalWindow.close(target); // PROBLEM: this doesn't call the
callback above
super.onSubmit(target, form);
}
};
add(submitBtn);
Problem is, the callback is not called by onSubmit(). And I can't call the
callback manually using the ModalWindow because I can't get to the callback
object, i.e. no getCloseButtonCallback() method.
How to solve this? Thank you.
Rudi
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/How-to-call-a-ModalWindow-s-close
-callback-tp4653456.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org