cssdata
cssdata

Reputation: 153

Which event to use on a <h:inputText> to cover all changes

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 ?

Upvotes: 4

Views: 9955

Answers (2)

Oversteer
Oversteer

Reputation: 1828

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.

Upvotes: 1

Lokesh Gupta
Lokesh Gupta

Reputation: 304

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.

Upvotes: 6

Related Questions