Triggers: Difference between revisions

48 bytes added ,  7 October 2016
m
no edit summary
mNo edit summary
mNo edit summary
Line 185: Line 185:


==== Data Validation ====
==== Data Validation ====
Using scripts, you can check the correctness of input data. For example, perhaps a field integer values ​​are allowed only from 0 to 200.
Using scripts, you can check the correctness of input data and deny saving of data that fail the test. For example, perhaps a field integer values ​​are allowed only from 0 to 200.


<source lang="javascript">
<source lang="javascript">
Line 195: Line 195:
</source>
</source>


This script should be used for the Event '''Creating an entry''' or '''Updating an entry''' in the Phase '''Before saving the entry'''. It will run synchronously.
This script should be used for the Event type '''Creating an entry''' or '''Updating an entry''' in the Phase '''Before saving the entry'''. It will run synchronously.


==== Set default values ====
==== Set default values ====