Skip to content

Developer Function: Script: $p.events.before_send

Overview

This explains how to specify a method to execute before sending data to the server. Use this to check whether the value entered in the column is correct.

Syntax

JavaScript

$p.events.before_send = function (args) {
    //Processing content
}
or
$p.events.before_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.

Usage Example

After setting the following sample code to the Pleasanter script and setting the output destination to "Edit", enter 100 into NumA on the editing screen and press the "Update" button.
The value will be set in ClassA only if it is entered correctly, and the screen will be updated (in this example, the value of the data-action attribute, Update, is explicitly stated).

JavaScript
$p.events.before_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.set($p.getControl('ClassA'), 'The input was correct.')
        return true;  //If true, it will be updated.
    }
}

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