• JMap.Form.validateData

    Returns errors for the given form id and data.

    If no error validation, it returns an empty object.

    The result is an object where :

    • key is the attribute id
    • value is the validation error message, translated in the user locale

    Parameters

    Returns JFormErrors

    an empty object if no validation error, else an object containing error messages grouped by attribute id.

    Example

    const form = ...
    const data = {
    name: "Jack"
    }
    // returns {} if no error, else could returns { age: "required field" }
    const errors = JMap.Form.validateData(form, data)