4

I want to update an icon immediately while the user enters a value into a <h:inputText>.

I have the following makup:

<h:inputText id="listprice" value="#{mybean.listPrice}">
    <f:converter converterId="mybean.convertPrice"/>
    <a4j:ajax event="keyup" render="infoIcon" />
</h:inputText>

Everything works fine if I realy type the value!

However if I revisit the page and start typing in the value, my firefox offers me a list of values from my previous sessions to select and now if I select one of those values with the mouse I don't get an event!

I understand this, because there is no keyup in this case. So I bound another event handler like this:

<h:inputText id="listprice" value="#{mybean.listPrice}">
    <f:converter converterId="mybean.convertPrice"/>
    <a4j:ajax event="keyup" render="infoIcon" />
    <a4j:ajax event="mouseout" render="infoIcon" />
</h:inputText>

... and tied all kinds of events from "onchange, to onmouseout" with no sucess.

So how to I cover this "event of selecting from a browser-sugesstion-list" immediatelly ?

cssdata
  • 153
  • 2
  • 9
  • 1
    how about `event="change"` (not onchange) – Daniel Aug 18 '12 at 13:41
  • You can try using the onchange event. A code example can be found [here][1] [1]: http://stackoverflow.com/questions/3937925/jsf-can-inputtext-invoke-a-method-inside-managed-bean-when-i-press-the-return-e?answertab=votes#tab-top – AshwinN Aug 18 '12 at 15:11

2 Answers2

6

If you don't want values from user previous sessions you can use attribute autocomplete="off".

Otherwise you can use onmouseup event, it works for me.

Lokesh Gupta
  • 304
  • 2
  • 8
  • onmouseup does not work for me either, however autocomplete="off" is excatelly what I'm using as a work around. Thanks! – cssdata Aug 19 '12 at 10:56
1

This may be a known bug and a workaround is suggested here: http://forums.mozillazine.org/viewtopic.php?f=38&t=584166&start=0&st=0&sk=t&sd=a

The linked post is very old and is discussing Firefox v2 so there's a fair chance that it is no longer relevant, but if you get a chance to try the suggested workaround perhaps you could let us know if it works or not.

Oversteer
  • 1,778
  • 1
  • 22
  • 38