4/16/2009

Richfaces: submit when enter key pressed


<a4j:form>
<h:inputText id="quick_search_client_id" value="#{searchCont.clientId}"/>

<a4j:commandButton type="submit" value="Search"
action="#{searchCont.search}" id="searchButton"/>
...
</a4j:form>

<rich:hotKey key="return"
handler="#{rich:element('searchButton')}.click()"
selector="#quick_search_client_id"/>

7 comments:

Anonymous said...

Thank you for your tip. It helped me a lot!

Anonymous said...

i have javascript problem with use this example:

jQuery.hotkeys is undefined
[Break on this error] return result;},_getComponentControlPara...ions=this.buildOptions(this.selector);}\nhotKey.js

help me somebody!

Mayank said...

The best answer ....

Eswar said...

Suppose If i use Jquery for some other purpose for this code.

That time not work hotKey.
So how to resolve.

Related question :

http://www.coderanch.com/t/496929/JSF/java/rich-hotKey-not-worked-when.

please Help me anybody.

Anonymous said...

Thanks for the post, very useful.

Anonymous said...

ya its working fine.Thanks

Anonymous said...

Easy win here. Thanks for the quick fix!