Reputation: 1161
I use jsf + richfaces + jboss seam. I have code :
<h:inputText id="receiptAmount" style="text-align: right;"
value="#{receiptsHome.instance.receiptAmountString}"
onkeypress="if((event.which < 48 && event.which != 8 && event.which != 26 && event.which != 44 && event.which != 46) || (event.which != 127 && event.which > 57)) return false;">
<a:support event="onkeyup" ajaxSingle="true"
reRender="receiptAmount1, listContractsDiv"
action="#{receiptsHome.setPaymentMoneyForListContracts}" />
</h:inputText>
But when i work on chrome. I have 2 case as below :
Case 1 : I enter number from keyboard with values : 20000. It run action in a:support tag and reRender red text at right. It's ok :
Case 2 : I does not use keyboard. I use mouse to click from autofill list with similar values : 20000 (browser has save old that value before). It's not run action in a:support tag :
How can i choose from autofill list,it's still run action ?
Upvotes: 0
Views: 67
Reputation: 20899
modern browser support oninput
(not sure if a4j
is supporting this event) which will be fired for both cases: If a key is pressed or if a autocomplete entry is choosen.
If you don't want to rely on this, use autocomplete="off"
on the input element. (However I believe some browsers are ignoring this).
If you don't need the data to be processed after each keystroke, the best option would be to use onblur
, because no matter if it was typing or an autocomplete selection, there will be a blur
event once the input element looses focus again.
Upvotes: 2