User Manual

08.14.2024

MANUAL

FAQ: Changing the value of one field to a specific value changes the value of another field

## Answer This can be achieved with a "[Script](/en/manual/table-management-script)". --- ## Overview The following is a sample code that changes the value of another item when a certain item is changed to a specific value on the Pleasanter editing screen. ## Operation 1. Create a table 1. Create a new "[Script](/en/manual/table-management-script)" and enter the contents of one of the following scripts. Check "Edit" for the output destination and update. 1. From the "[Editor](/en/manual/table-management-editor)", enable the Num A or Class A, and Check A items according to the sample code below. 1. Create a new record by clicking the [+New] button. 1. Open the edit screen for the record created in 3, set the [Status Item] to "Complete", enter "Class A" as "End", and press the [Update] button. ## Script ### 1. Set the value of the number A field to "1" when the status field is changed to "Completed" ##### JavaScript ``` $(document).on('change', '#Issues_Status', function() { //When the status field is changed to "Completed", automatically enter 1 into the number A field if ($p.getControl('Status').val() === '900') { $p.set($p.getControl('NumA'), 1); } }); ``` ### 2. Set the value of the number A field to "10" when the class A field is changed to "Ended" ##### JavaScript ``` $(document).on('change', '#Issues_ClassA', function() { //When the class A field is changed to "Ended", automatically enter 10 into the number A field if ($p.getControl('ClassA').val() === 'End') { $p.set($p.getControl('NumA'), 10); } }); ``` ### 3. Check the check A item when the class A item is changed to "End". ##### JavaScript ``` $(document).on('change', '#Issues_ClassA', function() { //Check the check A item when the class A item is changed to "End". if ($p.getControl('ClassA').val() === 'End') { $p.set($p.getControl('CheckA'), true); } }); ```
TOP
このページをシェアする
記載された商品名、各製品名は各社の登録商標または商標です。 © Implem Inc.