0

I'm trying to process an input and execute an action in JSF, but the action is not even executed. here is my code trying to reference the component with style class:

<h:panelGroup layout="block">
    <p:inputText id="txtClientCIN" widgetVar="ClientCIN" value="#{client.clientCIN}" required="true" styleClass="textcin"/>
    <p:commandButton id="btnSearchClient" icon="ui-icon-search" action="#{client.checkCIN}" process="@(.textcin)" update="@form" style="margin-left: 10px;"/>
</h:panelGroup> 

i tried to reference it with the id by setting process="txtClientCIN"

but did'nt work also.

when i change the process to @form the checkCIN() method gets executed just fine.

Ouerghi Yassine
  • 1,835
  • 7
  • 43
  • 72

1 Answers1

2

As I understand it:

Having a standard commandButton like this:

<p:commandButton actionListener=“#{bean.method}”/>

will process @form, call bean.method() and update nothing.

This instead

<p:commandButton actionListener=“#{bean.method}” 
                 process=“someComponentId” 
                 update=“otherComponentId”/>

will process “someComponentId” and update “otherComponentId”. But now the command button itself will not be processed, as it would in the first example. Meaning bean.method() will not be called.

So we need

<p:commandButton actionListener=“#{bean.method}” 
                 process=“@this someComponentId” 
                 update=“otherComponentId”/>

or either omit the process attribute completely or set it to “@form” (which is superfluous).

Further reading in the answer here.

Community
  • 1
  • 1
Jaqen H'ghar
  • 4,305
  • 2
  • 14
  • 26