User Manual

08.14.2024

MANUAL

FAQ: I want to perform my own input validation and display a message based on the results

## Answer Please use "[Script](/en/manual/table-management-script)". --- ## Overview If you want to perform your input validation in "[Script](/en/manual/table-management-script)", please implement your input validation and result message display process in [$p.events.before_validate](/en/manual/script-events-before-validate) of the event firing script. ## Operation Procedure 1. Please enable the Number A item from the Editor tab. 1. Create a new "[Script](/en/manual/table-management-script)", write the script's contents below, and check "Edit" for the output destination to update. 1. Create a new record, enter a blank or a value other than 100 in Number A on the editing screen, and press the "Update" button. ### Execution Result ![image](https://pleasanter.org/binaries/44a63a15b0724495819900ab0ee03e0b) ![image](https://pleasanter.org/binaries/e682b6b33fe844c3913338e6c08cd635) ## Sample Code ##### JavaScript ``` $p.events.before_validate_Update = function (args) { var myNumA = $p.getControl('NumA').val() if (myNumA == "") { $p.clearMessage(); $p.setMessage('#Message', JSON.stringify({ Css: 'alert-warning', Text: 'No value entered. Please enter a number.' })); return false; //If false, processing stops and no update occurs } else if (myNumA != 100) { $p.clearMessage(); $p.setMessage('#Message', JSON.stringify({ Css: 'alert-error', Text: 'Please enter the number 100.' })); return false; //If false, processing stops and the value is not updated } else { return true; //If true, the value is updated } } ```` ## Related Information <div id="ManualList"><ul><li><a href="/en/manual/table-management-script">Table Management: Script</a><span>08.13.2024 up</span></li></ul></article></div><input id="SearchTextHidden" type="hidden" value="" />
TOP
このページをシェアする
記載された商品名、各製品名は各社の登録商標または商標です。 © Implem Inc.