AjaxTabbedPabelTab contains a list of items (WORepetition).
Any such item can have an AjaxModalDialogOpener to open an edit dialog for that particular item.
public WOActionResults resendRemoteRequest() {
// preparation and stuff
// compose and send out mail
EmailRequestingRemoteSignatureAndPayment mailComponent = pageWithName(EmailRequestingRemoteSignatureAndPayment.class);
mailComponent.setLink(url);
// more mailComponent.set(...)
try {
ERMailDeliveryHTML message = new ERMailDeliveryHTML();
message.setComponent(mailComponent);
message.setSubject("Please sign your contract with " + companyName);
message.setToAddress(availableEmailAddressesLoopvar.emailAddress());
message.setFromAddress(application().notificationSenderEmail());
message.sendMail();
}
catch (Exception ex) {
log.error("Error sending notification Email: " + ex.getMessage());
ex.printStackTrace();
dialogErrorMessage = "Failed to send Email";
AjaxModalDialog.update(context(), "ERROR - Could not send Email");
return null;
}
// everything is fine, let's save things
ec.saveChanges();
AjaxUpdateContainer.updateContainerID(REMOTE_REQUEST_UPDATE_CONTAINER_ID);
AjaxModalDialog.close(context());
return null;
}
Unfortunately I get very weird behavior...
Code written above returning both trigger for update and trigger to close dialog:
Dialog does not close and is dead in the water. No update happens, I have to manually reload the page in the browser. Then everything is fine.
Using updateContainerId binding on the AjaxSubmitButton that calls the above action and no call to trigger update from Java :
Dialog closes but the mail message text is pasted into the browser window! WHAT?! And no update happens (no data is reloaded)
No update container at all:
dialog closes properly, but nothing updates (of course)
What is going on here? How should I handle this stuff? I was thinking of returning a WORedirect, but how do I get the proper URL?
Thoroughly confused!
---markus---