UPBrandon wrote: > > That seems to work. I was trying to do exactly that earlier. At the > time, I couldn't seem to access the setResponsePage() method but I must > have been doing something wrong. For anyone who might be reading this > later, I ended up calling setResponsePage(getPage() ); > > The only problem I am having now is that ModalWindow has an annoying "are > you sure you want to navigate away from this page" JavaScript confirm > since the modal window is open when the browser tries to move on. Maybe > there's something in the API to disable that warning... > >
I had this exact same problem but found my own way around it. I'm using a page for my modal window (so it probably would work a bit different if you're using a Panel). When I create my modal, I pass the parent page to the constructor and store that as a member variable as well as the ModalWindow object. In the onSubmit handler of my ajax submit button I do: if(/*Custom form vaidation*/) { /* Submit form data */ parent.setSubmitted(true); // this sets a variable in the parent class that is initialized to false modalWindowObject.close(target); } else { target.addComponent(ModalWindowForm.this); // The allows you to see the feedback panel inside the modal window, assuming it is inside the form } Then in the onClose handler of my modal window: if(isSubmitted()) { // Checks the member variable the modal window set on submit (keeps whole page from refreshing if you close modal by other means) setResponsePage(ModalWindowParent.class); } The code may vary depending on your specific setup (particularly if you're using a panel instead of a page for you modal window), but I think it should be workable. Not sure how it will work with wicket's built-in validators, because I currently don't use those. I spent quite some time trying to figure out how to do this, so I hope it benefits others. Seems to be the best way of handling a page modal which has an internal feedback panel, which refreshes the whole page on a successful submit, but not on a failure (or other close modal events). It also avoids the annoying popup, since you're directly calling the close function. Joel -- View this message in context: http://www.nabble.com/Refresh-a-page-from-an-AjaxButton--tf4469626.html#a12756667 Sent from the Wicket - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]