I would like to trigger an AJAX call when the user sets focus within an h:form
, any field in the form. I explicitly do not want the call to be triggered when (s)he moves the cursor between different form fields. I currently do it using the click
event in an f:ajax
tag:
<h:form>
<f:ajax event="click" listener="#{myController.formFocusResponse}"/>
However, that triggers each time the user clicks on the form. If there are 5 form fields, the ajax call is triggered each time the user moves onto the next field.
The available events for the form are:
click
dblclick
keydown
keypress
keyup
mousedown
mousemove
mouseout
mouseover
mouseup
Q1: Why is something like a focus
or select
event supported for h:form which, unlike the click
, only gets triggered when the user first enters the form component?
Q2: Is there a way to hack or simulate a call trigger using other events or any other tool from the JSF kit?