Skip to content

$p.events.after_send

Overview

This explains how to specify the method to be executed after sending data to the server.

Limitations

  1. If you create multiple scripts and write this function in each of them, the scripts are overwritten, so only the latest one works. For a workaround, refer to the following FAQ.

How To Use

JavaScript

$p.events.after_send = function (args) {
    //Processing content
}
or
$p.events.after_send_{Value of the data-action attribute} = function (args) {
    //Processing content
}

*Get this if you want to explicitly write the value of the data-action attribute of the button that will cause the event.

Code Samples

After setting the following sample code to the Pleasanter script and setting the output destination to "Edit", the data will only be updated when you enter 100 in the NumA field and press the "Update" button on the edit screen (in this example, the value of the data-action attribute, Update, is explicitly stated).

JavaScript
$p.events.after_send_Update = function (args) {
    if($p.getControl('NumA').val() != 100){
        return false; //When it is false, the process stops and the update does not occur.
    }else {
        $p.setMessage('#Message', JSON.stringify({
            Css: 'alert-success',
            Text: 'The data for NumA has been sent to the server.'
            })
        );
        return true;  //If true, it will be updated.
    }
}

FAQ: I want to be able to set multiple $p.events.on_editor_load