Hi Chris, I think all this is actually related to ModalWindow, not to Form. You don't close the Form, you close the ModalWindow. ModalWindow#close() accepts AjaxRequestTarget (ART) so it is clear that it needs to be in Ajax request, no ? The form is just a component in the ModalWindow. With or without a form inside it the ModalWindow needs ART.
On Mon, Dec 3, 2012 at 11:27 PM, Chris Colman <chr...@stepaheadsoftware.com>wrote: > The other important thing to mention in Form's Javadoc is that a form in > a ModalWindow can not be closed without AJAX. i.e. you can't do the > close in the standard Form.onSubmit handler as that is given no > AjaxRequestTarget parameter which is required to perform the ModalWindow > close. Trying to close it in the implicit way results in the browser > throwing up a pop up asking the user if they want to "Leave this page" > or "Stay on this page" - which is pretty bad. > > >-----Original Message----- > >From: Martin Grigorov [mailto:mgrigo...@apache.org] > >Sent: Monday, 3 December 2012 11:18 PM > >To: users@wicket.apache.org > >Subject: Re: Best way to trap Enter key in a form in a modal window > > > >Hi, > > > >On Mon, Dec 3, 2012 at 1:05 PM, Chris Colman > ><chr...@stepaheadsoftware.com>wrote: > > > >> I understand that with a form in a modal window you must explicitly > >> declare an AjaxButton component because modal windows require AJAX > comms > >> (BTW this should probably be mentioned in the Form Javadoc page > >> somewhere: http://ci.apache.org/projects/wicket/apidocs/6.0.x/) > >> > > > >I didn't get what should be better explained ? > > > > > >> > >> However, what is the best approach to providing a 'catch all' so that > if > >> the user presses the 'Enter' key while focus is on any field in the > form > >> the normal submit takes place? > >> > > > >See Form#setDefaultButton. > >Not sure whether this will help in Ajax form submit though. > > > >Additionally check https://github.com/kinabalu/wicket-mousetrap/ > > > >-- > >Martin Grigorov > >jWeekend > >Training, Consulting, Development > >http://jWeekend.com <http://jweekend.com/> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com <http://jweekend.com/>