posted 11 years ago
Yes I'm sure you can't do that. Webapps don't run as continuous processes, so there'd be nothing running that could push out the close command even if if was legal to send a command out without receiving a request first. Which it isn't, even in non-Java webapps.
You can put a close() command on the popup's "Submit" button, though, and I do that all the time. It's not run from the managed bean - it runs on the client.
If you want the dialog to conditionally close - for example, if the submit fails, display a message on the dialog and keep it open - that's a stickier problem. I have a solution, but it's specific to RichFaces V3 and involves the ability of the a4j:commandButton/commandLink controls to return a JSON datastream that contains a go/no-go value and an error message.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.