Thanks Steve,

I did attempt something like that, but my real issue is that the form is submitted from the modalwindow, and the onSubmit of the AJaxButton is actually called after the form is successfully submitted, so by the time I know something happened, its already made the round trip to the server. In my case, even passing back to the parent on close would be too late :)

I'm actually starting to think I'm going to need to do something drastic like customize my own button, so I can do both... that or ModalWindow, which should know enough about it self to close itself without having a target.

- Brill

On 26-May-09, at 3:12 AM, Steve Swinsburg wrote:

Brill this is what I do for a window of mine, it has a few buttons and the parent page needs to know what one was clicked. Doing it in the button's onSubmit works.

I pass an object into the ModalWindow's constructor, which was initialised in the parent page, then I set a property into an object in the AjaxButton onSubmit, then close it via window.close(target). The parent can then see the property in the WindowClosedCallback method which fires when it closed.


cheers,
Steve


On 26/05/2009, at 7:37 AM, Brill Pappin wrote:

Tried that :)
and it always seems to be null.

I switched to AjaxButtons, but the problem is that the are fired *after* the form submits, not before as a normal Button is. I'm essentially trying to set a value on the form's model depending on which button was pressed, and then close the ModalWindow on successful submit. There needs to be an easier way to do this... at the moment I'm starting to think I'm going to have to try and attache some javascript that will trigger pre-submit to set some sort of flag... but its getting very dirty.

- Brill


On 25-May-09, at 10:48 AM, Jeremy Thomerson wrote:

If all you're saying is that you need to do it from your form's onsubmit, do this:

AjaxRequestTarget art = AjaxRequestTarget.get();
if (art != null) {
modal.close(art);
}

Jeremy Thomerson
http://www.wickettraining.com
-- sent from a wireless device


-----Original Message-----
From: Brill Pappin <[email protected]>
Sent: Sunday, May 24, 2009 5:36 PM
To: [email protected]
Subject: Re: closing a ModalWindow from a forms onSubmit?

I likely could but am trying to avoid that, because then I have to
call it for every button in the form (there are 4 now, all set a state
and allow the event to propagate to the forms onSubmit().
Is there no way to know the current context from the component itself?


- Brill

On 24-May-09, at 5:55 PM, James Carman wrote:

Can you submit the form via ajax?

On May 24, 2009 2:08 PM, "Brill Pappin" <[email protected]> wrote:

I have a form in a model window
How do I close the ModalWindow in the form's onSubmit() method
without the
AjaxRequestTarget?

- Brill



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to