• Post Reply Bookmark Topic Watch Topic
  • New Topic

Fire a method on key stroke [SOLVED]  RSS feed

 
Leigh Taylor
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm trying to include some functionality into my project with the following logic. For each press of a key in an input text field, trigger a java method.

Is it possible to do this using jsf with a4j?

You can call a javaScipt method on each key press so i'm sure the same is applicable for a java method.

I am using a <h:inputText> tag and tried using some a4j support but haven't had any luck.

Leigh
[ March 03, 2008: Message edited by: Leigh Taylor ]
 
Tim Holloway
Bartender
Posts: 18664
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should. But the javascript key event handler would have to do an AJAX submit to the J2EE server each time and (presumably) handle the resulting response.

It's likely to be very sluggish, especially on the open Internet.
 
Leigh Taylor
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tim,

I have found a way to do and so far have only tested it with a one person load and it seems fast. Will be interesting to see how it goes under load. Will post results back up here when i do that.

<h:inputText id="IA_Lcly" value="#{searchUI.lclyName}">
<a4j:support event="onkeyup" limitToList="true"
action="#{searchUI.calculateMatchesOnTheFly}"
reRender="OA_Panel" />
</h:inputText>

Leigh
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!