All Downloads are FREE. Search and download functionalities are using the official Maven repository.

widgets.pbButton.help.html Maven / Gradle / Ivy

There is a newer version: 1.0.9
Show newest version

    
        

Use this widget to:

  • Start a process
  • Submit a task
  • Add/Remove an Object to/from a collection
  • Perform an HTTP request

For HTTP requests, the following methods are supported:

  • GET
  • POST
  • PUT
  • DELETE

To control modal containers, the following methods are supported:

  • Open modal
  • Close modal

The data sent on click for POST and PUT requests must be a JavaScript Object (JSON can be used). This data will be sent in the body of the request.

For Start process and Submit task actions the format of the data must meet the process/task contract specifications.

For HTTP requests and Start process / Submit task actions, you can store the response of the request in a variable using the properties:

  • Successful response value: the variable will be set if the request is successful (code 2XX)
  • Failed response value: the variable will be set if the request is unsuccessful (code 4XX)

In addition to the Successful response value variable, for the POST,PUT,DELETE, Start process and Submit task requests you also have the possibility to define a Target URL on success that will be used to set the current window (frame) location when the request is successful.

However, such a redirection of the current window (frame) won't be performed in Bonita portal nor in an application iframe with id bonitaframe (as in the default application layout). This is due to the fact that Bonita Portal and the default application layout handle the successful response by themselves.

If the page is displayed inside an iframe, a JavaScript postMessage will be sent to the parent frame with the status of the response and the properties values of the button widget. Bonita portal, tasklist or the default application layout handle this message differently:

  • The portal and tasklist will redirect to the process list (Start process action) or refresh the task list (Submit task action).
  • The default application layout will retrieve the Target URL on success that was sent in the message and set its window location with it.

The following documentation applies if you need to handle the behavior on success yourself (e.g. if you build your own tasklist or any page with an iframe to display forms).

Here is the format of the message posted to the parent frame in JSON (in the parent frame you will need to call JSON.parse as it is stringified before being sent):

            {
              message: 'success',
              status: 200,
              dataFromSuccess: 'response body'
              targetUrlOnSuccess: 'myTasks'
              ...
            }
        

For an error response, the message value is 'error' and the property dataFromSuccess is replaced by a property dataFromError

For an example of JavaScript code to handle the message, you can have a look at the asset layout.js in the default application layout (you can retrieve it in the resources section of Bonita Portal Administrator profile).

Add to collection or Remove from collection actions can be used to prepare the data before sending it to the server (e.g. if you have a process/task contract with an input that is multiple). No request will be sent to the server. The button will just update the Collection data which must be a variable of type array ([] in JSON).

The property Value to add can either be a JavaScript Object or a String depending on the format expected for the collection you are building.

The Open modal action can be used to open any modal container on the page. To point towards the right one, specify the ID in the button's "Modal ID" property.

The Close modal action will close the modal container that contains the button when it is pressed.

Any button can close a modal container that contains it when a success happens after any button action.





© 2015 - 2024 Weber Informatics LLC | Privacy Policy