HOW TO Render custom validation errors

Eric BREHAULT edited this page Sep 23, 2016 · 1 revision

Replace the default error popups.

When a user submits a form, Plomino makes an AJAX call to the server to validate the current field values and collect error messages if any.

The error messages are then used to produce a popup listing all the error messages.

If we want to replace this popup, we can now define our own custom callback. The function must be named plomino_custom_validation_callback.

We can define it in a computed for display richtext field or in our skin, and the code will be like that:

window.plomino_custom_validation_callback = function(data) {
    if(data.success) {
        return;
    }
    for(var i=0;i<data.errors.length;i++) {
        alert(data.errors[i]);
    }
}