Skip to main content

beforeChange

fires before changing the value of a control

beforeChange: (value: object) => boolean | void;

Parameters:

  • value: object - the value expected to be applied after changes

Returns:

Return false to prevent changing the value of the control; otherwise, true.

Example

form.getItem("avatar").events.on("beforeChange", value => {
return value.file && value.file.size <= 2097152;
// prevent changes if the size of the uploaded file is
// more than 2Mb or the file is empty
});