Skip to content

Enter Key on p:inputText

This is a way how you can trigger an ajax event with Primefaces if you want to submit the inputText field with an enter key press:

Use jQuery to trigger the change event:

<p:inputText id="name" value="#{bean.value}" 
    onkeypress="if (event.keyCode == 13) {jQuery('#name').trigger('change'); return false; }" >
    <p:ajax event="change" update="@form" listener="#{bean.search}" />
</p:inputText>