context.AddResponse
Overview¶
The "Server Script" returns an arbitrary client response.
Limitations¶
- Even if you specify the method "Href", the product's own behavior may take precedence in some cases, such as the screen transition after creating a child record with a create button in "Creation of linked item".
Syntax¶
Parameters¶
| Parameter | Type | Overview |
|---|---|---|
| method | string | Specify the operation type of the response. Refer to the method section below. |
| target | string | Specify the ID of the target element. |
| value | object | Specify the element or value. |
Methods¶
| Type | Description |
|---|---|
| ReplaceAll | Replace the element specified for target above with the element specified for value. |
| Set | Store information in the form. |
Return Value¶
There is no return value.
Usage Example 1¶
In the following example, the field for ClassC is replaced with \
context.AddResponse('ReplaceAll','#Results_ClassCField','<div class="field-normal" style="color:red">Pleasanter</div>');
Usage Example 2¶
In the following example, the following information is stored in the form ($p.data.MainForm).
【Information to store】
- Column: NumA Column
- Value: 123
Usage Example 3¶
In the following example, after the record is created, the screen transitions to the table with site ID 1234.
Code Samples¶
1. Display an announcement in the guide when overdue records exist in the table
This is sample code that dynamically replaces the text of the guide with the ReplaceAll method.
When the index of a time-limited table is displayed, it gets the overdue records, and if there is at least one overdue record, it replaces the contents of the guide with the ReplaceAll method.
Notes
This sample supports version 1.5.0.0 and later.
CSS¶
Setting the following style makes the text color of the guide red.
JavaScript¶
Condition: Before opening the page