-
1. Re: How to Assume a Search Button was click when pressing "enter key"
jsfgeeks Jan 27, 2010 5:11 AM (in response to efsandino)Hi Eduardo,
I suggest to use <a4j:support> in your form. This might solve your problem. You can use <a4j:support> like below,
<a4j:support event="onkeyup" onsubmit="if (event.keyCode!=13) return false; " action="#{backbean.action_event}" reRender="whatever_u_want_to_reRender" />
I think this will help you.
Regards,
JSF GEEKS
-
2. Re: How to Assume a Search Button was click when pressing "enter key"
efsandino Jan 27, 2010 9:43 AM (in response to jsfgeeks)Thanks.. but i have found a solution i want to share:
<a4j:jsFunction name="jsEnterFunction"
action="#{behaviorListView.filterSearch()}"
reRender="behaviorListPanel" />
<rich:hotKey selector=".searchControl" key="return"
handler="jsEnterFunction()" />I use a4j:jsFunction with rich:hotKey with a selector. And just the controls that has the focus and implement the styleClass="searchControl" will catch the enter key event... Thanks.. I prefered did this way because if i show dialogs and i pressed the EnterKey in the background still the enter was catched.
This is inspired in a previous solution you JSF Geeks gives us in other discussion: http://community.jboss.org/message/516900#516900
Thanks..
-
3. Re: How to Assume a Search Button was click when pressing "enter key"
jsfgeeks Jan 29, 2010 3:45 AM (in response to efsandino)Hi there,
Yes, obviously, both will work fine. The choice is yours.
Regards,
JSF GEEKS