<a4j:commandLink onclick="return call();" action="#{bean.deleteUser(all_user.userID)}" reRender="viewUserGrid">
<h:graphicImage style="border-style:none;" url="/images/delete.jpg" height="10px" />
</a4j:commandLink>
The problem is deleteUser method is not getting invoked in the backing bean why is it so.But it is invoking the javascript function Please help me.
The problem is that you’re returning a value in your “onclick” method. Assumming that your
calljs method returns a true or false, the code must be changed to:Further explanation:
The HTML generated code for your actual code will look like this (or something familiar):
If you see, the
return call();method is at the beginning of theonclick, so the ajax submit won’t be called. By the code updated I provide, the code will be similar to this:With this change, if your
calljs method returns false, then the ajax call won’t be submitted, if it returns true, then your ajax call will be made. As a note, if a javascript method doesn’t return any value, it will return false by default.UPDATE: The proposed code will work with RichFaces 3.x. In case you use RichFaces 4.x Your commandLink should look like