This content has been marked as final.
Show 1 reply
-
1. Re: a4j:ajax event for submit or enter keyboard
mcmurdosound Nov 7, 2011 9:22 AM (in response to bouz78)I usually use something like this:
<h:inputText id="quickSearch"
value="#{myManager.searchString}"
onkeypress="doSearch(event)"
/>
<h:commandLink id="doSearchLink"
value="search"
action="#{myManager.search}"
/>
<script type="text/javascript">
function doSearch(event){
// on enter: start search
if (event.which == "13") {
event.preventDefault();
document.getElementById('form:doSearchLink').click();
}
}
</script>
this works in Firefox. For IE you have to use another "event" event and other properties.
Instead of a h:commandLink you could call an a4j:jsFunction