This content has been marked as final.
Show 1 reply
-
1. Re: Prevent onkeyup event when input field first gets focus
langer123 Jun 23, 2011 7:12 AM (in response to langer123)Found a solution:
I put in a check to prevent the ajax call firing if the user tabbed into the input box. The addition of the extra a4j:support component is to allow the ajax call when tabbing out of the input box.
<h:inputText id="limit1" value="#{bean.purchaseTypeItem.subPurchaseLimit}" immediate="true"> <f:converter converterId="javax.faces.BigDecimal" /> <f:attribute name="fieldRef" value="Purchase Limit1" /> <a4j:support event="onkeyup" ajaxSingle="true" immediate="true" requestDelay="200" actionListener="#{bean.validateAmount}" ignoreDupResponses="true" reRender="main" onsubmit="if(event.keyCode == 9){return false;}" /> <a4j:support event="onblur" ajaxSingle="true" immediate="true" requestDelay="200" actionListener="#{bean.validateAmount}" ignoreDupResponses="true" reRender="main" />