-1

Hi i have this demo form with RF 4.5.2, the oncomplete execute 3 times, i need a way to execute a method after the ajax call but only one time, i think that is the behaviour of the oncomplete but if it doesnt you can suggest any other ideas to accomplish this:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"> 

<h:head></h:head> 
<body>
    <rich:panel>
    <h:form>
        <a4j:commandButton  id="btnAccion" value="enviar" oncomplete="#{archivoAfipController.emptyAction()}"/>
    </h:form>
    </rich:panel>
</body> 
</html>
Alexander O'Mara
  • 58,688
  • 18
  • 163
  • 171
Ignacio
  • 121
  • 3
  • 10
  • what does the `enter code here` do in your code ?! On the other hand, oncomplete must be a javascript function and not a method expression – Tarik Feb 01 '15 at 12:21

1 Answers1

0

You're supposed to use the action attribute for the purpose of invoking a managed bean method on submit.

<a4j:commandButton ... action="#{archivoAfipController.emptyAction}" />

The oncomplete must represent a client side script expression (thus, e.g. JavaScript, which is in JSF perspective basically a plain vanilla String!), which should be executed when the ajax action has completed, the response has returned, and all necessary parts of the view have been updated in the client side.

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555