>On Tue, Dec 4, 2012 at 11:31 PM, Chris Colman
><chr...@stepaheadsoftware.com>wrote:
>
>> >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.
>>
>> I know logically it all makes sense but logic and newbies don't
always
>> mix ;) I thought it could help any newbies who might have just
learned
>> all about how to handle forms in a page and then tried to apply that
>> same knowledge to a form in a modal only to find it doesn't work.
>>
>> Some people are experiencing this issue in their learning curve:
>>
>>
http://stackoverflow.com/questions/7239917/wicket-form-in-a-modal-window
>>
>> Maybe the hint could go in ModalWindow Javadoc, not the form Javadoc.
>>
>> There is already a mention of special treatment of forms in the
>> ModalWindow Javadoc:
>>
>> "If you want to use form in modal window component make sure that you
>> put the modal window itself in another form (nesting forms is legal
in
>> Wicket) and that the form on modal window is submitted before the
window
>> get closed."
>>
>> Perhaps an additional mention, with possible example, of how you
can't
>>
>
>The problem is that you actually can do it.
>You just don't know how yet.
>
>> use the implicit form submission mechanism to close a ModalWindow
with a
>> form would be appropriate to add to this existing section on dealing
>> with forms in a ModalWindow.

By 'implicit' I mean the non AJAX way - which isn't possible inside a
modal unless the model is in a page in an iframe - It may be unfounded
but I've always regarded anything that needs an iframe as 'hacky' -
doesn't mean I haven't been forced to use them in the past though ;)

>If I remember correctly you contributed
>https://github.com/wicketstuff/core/tree/core-1.5.x/jdk-1.5-parent/moda
lx-
>parent
>,
>right ?

Correct. The issue about the forms in Modal's needing AJAX submit
processing is an issue I had many years ago when I was a Wicket newbie
so as an aside to this thread I thought a note in the Javadoc might help
future newbies.

>I thought you know the internals of this component better than me ;-)

ModalX doesn't currently support 'Enter' key processing and that was the
main thrust of this thread - working out the best way to implement that.

>
>
>>
>> >
>> >
>> >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/>
>>
>> ---------------------------------------------------------------------
>> 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/>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to