We are migrating from JSF 1.2 to JSF 2.2.6 along with RichFaces 4.5.2. Facing issues with the oncomplete
not getting called. The JS function during onclick
gets called, but JS in oncomplete
does not get called. How is this caused and how can I solve it?
<h:commandLink ... onclick="ed();" oncomplete="cEd(#{rowIndex});">
There is indeed no such attribute in standard JSF <h:commandLink>
. You're most likely confusing with RichFaces <a4j:commandLink>
which does have that attribute or even PrimeFaces <p:commandLink>
which also has that attribute. The same applies to the <xxx:commandButton>
brother.
You've basically 2 options:
Just replace <h:commandLink>
by <a4j:commandLink>
or <p:commandLink>
.
<a4j:commandLink ... oncomplete="oncompleteFunction()" />
<p:commandLink ... oncomplete="oncompleteFunction()" />
Nest a <f:ajax>
with an event handler inside <h:commandLink>
.
<h:commandLink ...>
<f:ajax onevent="oneventFunction" /><!-- No parenthesis! -->
</h:commandLink>
function oneventFunction(data) {
if (data.status === "success") {
oncompleteFunction();
}
}
Summarized: just read the tag documentation. Links are in 1st paragraph above.