DHTMLX Docs & Samples Explorer

Index
dhtmlxconnector
Validating Data

## Validating Data

To implement server side validation of incoming data you can use “beforeUpdate”, “beforeInsert”, “beforeDelete” or “beforeProcessing” event. “beforeProcessing” event occurs for all types of operations, while other events occurs only for related operations, so you can have different validation rules for different operations.

Event will receive DataAction object as parameter. This object can be used to retrieve related data and allow|deny operation. ( beware that it contains only data which was received from client side, not the all data related to the record, as DataItem object has )

            function validate($data){
                 if ($data->get_value("some")=="")
                      $data->invalid();
            }
            $conn->event->attach("beforeProcessing","validate");