Triggers: Difference between revisions

370 bytes removed ,  18 September 2016
m
no edit summary
mNo edit summary
mNo edit summary
Line 162: Line 162:
=== Examples ===
=== Examples ===


====Валидация данных====
==== Data Validation ====
С помощью скриптов можно проверять корректность вводимых данных. Например для поля Целое число допустимы значения только от 0 до 200.
Using scripts, you can check the correctness of input data. For example, for a field integer values ​​are allowed only from 0 to 200.
 
<source lang="javascript" line>
<source lang="javascript" line>
var num = entry().field("Number")
var num = entry().field("Number")
Line 171: Line 172:
}
}
</source>
</source>
#Получаем значение поля Number
 
#Проверяем значение на соответствие допустимому диапазону
# We get the value of the field Number
#Если значение выходит за рамки диапазона то выводим сообщение ''Wrong range''.
# Tests for values ​​matching the allowable range
#Отменяем операцию.
# If the value is out of range then display a message Wrong range
Данный скрипт следует использовать для действия ''Создание записи'' или ''Изменение записи'' и фазы ''Перед сохранением''.
# Cancels the operation
 
This script should be used for the action Create recording or change the recording and phase before saving .


====Установка значений по умолчанию====
====Установка значений по умолчанию====