You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Chris Colman <ch...@stepaheadsoftware.com> on 2012/12/03 13:05:33 UTC

Best way to trap Enter key in a form in a modal window

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

Re: Best way to trap Enter key in a form in a modal window

Posted by Martin Grigorov <mg...@apache.org>.
OK, please send a patch for ModalWindow's javadoc.


On Wed, Dec 5, 2012 at 1:41 AM, Chris Colman
<ch...@stepaheadsoftware.com>wrote:

> >On Tue, Dec 4, 2012 at 11:31 PM, Chris Colman
> ><ch...@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
> >> ><ch...@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:mgrigorov@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
> >> >> ><ch...@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-unsubscribe@wicket.apache.org
> >> >> For additional commands, e-mail: users-help@wicket.apache.org
> >> >>
> >> >>
> >> >
> >> >
> >> >--
> >> >Martin Grigorov
> >> >jWeekend
> >> >Training, Consulting, Development
> >> >http://jWeekend.com <http://jweekend.com/>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
> >
> >--
> >Martin Grigorov
> >jWeekend
> >Training, Consulting, Development
> >http://jWeekend.com <http://jweekend.com/>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

RE: Best way to trap Enter key in a form in a modal window

Posted by Chris Colman <ch...@stepaheadsoftware.com>.
>On Tue, Dec 4, 2012 at 11:31 PM, Chris Colman
><ch...@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
>> ><ch...@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:mgrigorov@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
>> >> ><ch...@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-unsubscribe@wicket.apache.org
>> >> For additional commands, e-mail: users-help@wicket.apache.org
>> >>
>> >>
>> >
>> >
>> >--
>> >Martin Grigorov
>> >jWeekend
>> >Training, Consulting, Development
>> >http://jWeekend.com <http://jweekend.com/>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
>--
>Martin Grigorov
>jWeekend
>Training, Consulting, Development
>http://jWeekend.com <http://jweekend.com/>

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


Re: Best way to trap Enter key in a form in a modal window

Posted by Martin Grigorov <mg...@apache.org>.
On Tue, Dec 4, 2012 at 11:31 PM, Chris Colman
<ch...@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.
>

If I remember correctly you contributed
https://github.com/wicketstuff/core/tree/core-1.5.x/jdk-1.5-parent/modalx-parent
,
right ?
I thought you know the internals of this component better than me ;-)


>
> >
> >
> >On Mon, Dec 3, 2012 at 11:27 PM, Chris Colman
> ><ch...@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:mgrigorov@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
> >> ><ch...@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-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
> >
> >--
> >Martin Grigorov
> >jWeekend
> >Training, Consulting, Development
> >http://jWeekend.com <http://jweekend.com/>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

RE: Best way to trap Enter key in a form in a modal window

Posted by Chris Colman <ch...@stepaheadsoftware.com>.
>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
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.

>
>
>On Mon, Dec 3, 2012 at 11:27 PM, Chris Colman
><ch...@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:mgrigorov@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
>> ><ch...@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-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
>--
>Martin Grigorov
>jWeekend
>Training, Consulting, Development
>http://jWeekend.com <http://jweekend.com/>

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


Re: Best way to trap Enter key in a form in a modal window

Posted by Martin Grigorov <mg...@apache.org>.
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
<ch...@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:mgrigorov@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
> ><ch...@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-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

RE: Best way to trap Enter key in a form in a modal window

Posted by Chris Colman <ch...@stepaheadsoftware.com>.
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:mgrigorov@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
><ch...@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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Best way to trap Enter key in a form in a modal window

Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
Hi,

On Mon, Dec 3, 2012 at 10:11 PM, Chris Colman
<ch...@stepaheadsoftware.com>wrote:

> >Hi,
> >
> >On Mon, Dec 3, 2012 at 1:05 PM, Chris Colman
> ><ch...@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 ?
>
> The part about using a form in a ModalWindow. Form's current Javadoc
> contains no mention of how to use a form in a ModalWindow i.e. the
> implicit handling of form submit will not work properly when the form is
> in a ModalWindow - it requires AJAX submit.
>
>
This is not necessarily true, I think. If the modal contains a Page (in an
iframe) and not a panel, in that case submit can be a "standard" submit.

-- 
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/ <http://antiliasoft.com/antilia>

RE: Best way to trap Enter key in a form in a modal window

Posted by Chris Colman <ch...@stepaheadsoftware.com>.
>Hi,
>
>On Mon, Dec 3, 2012 at 1:05 PM, Chris Colman
><ch...@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 ?

The part about using a form in a ModalWindow. Form's current Javadoc
contains no mention of how to use a form in a ModalWindow i.e. the
implicit handling of form submit will not work properly when the form is
in a ModalWindow - it requires AJAX submit.

>> 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-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Best way to trap Enter key in a form in a modal window

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

On Mon, Dec 3, 2012 at 1:05 PM, Chris Colman
<ch...@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/>