formcycle 8.3.6 - JavaScript for forms
    Preparing search index...

    Interface XUtilCallbacks

    Mapping between event names and callback types for callbacks that can be registered via XUtil.on.

    interface XUtilCallbacks {
        addRow: (params: XUtilOnAddRowData) => void;
        afterLoadFormData: (params: XUtilOnAfterLoadFormDataData) => void;
        afterPrint: (params: XUtilOnAfterPrintData) => void | Promise<void>;
        afterSaveFormData: (params: XUtilOnAfterSaveFormDataData) => void;
        beforeAddRow: (
            params: XUtilOnBeforeAddRowData,
        ) => void | XUtilOnBeforeAddRowResult;
        beforeClearAll: (params: XUtilOnBeforeClearAllData) => void;
        beforeDeleteRow: (
            params: XUtilOnBeforeDeleteRowData,
        ) => void | XUtilOnBeforeDeleteRowResult;
        beforeLoadFormData: (
            params: XUtilOnBeforeLoadFormDataData,
        ) => void | XUtilOnBeforeLoadFormDataResult;
        beforeResetAll: (params: XUtilOnBeforeResetAllData) => void;
        beforeSaveFormData: (
            params: XUtilOnBeforeSaveFormDataData,
        ) => void | XUtilOnBeforeSaveFormDataResult;
        clear: (params: XUtilOnClearData) => void;
        deleteRow: (params: XUtilOnDeleteRowData) => void;
        disable: (params: XUtilOnDisableData) => void;
        enable: (params: XUtilOnEnableData) => void;
        fileChange: (params: XUtilOnFileChangeData) => void;
        hide: (params: XUtilOnHideData) => void;
        loadNavigation: (
            params: XUtilOnLoadNavigationData,
        ) => void | XUtilOnLoadNavigationResult;
        print: (params: XUtilOnPrintData) => void | Promise<void>;
        readOnly: (params: XUtilOnReadOnlyData) => void;
        resetAll: (params: XUtilOnResetAllData) => void;
        saveNavigation: (
            params: XUtilOnSaveNavigationData,
        ) => void | XUtilOnSaveNavigationResult;
        show: (params: XUtilOnShowData) => void;
        submit: (params: XUtilOnSubmitData) => void | XUtilOnSubmitResult;
    }
    Index

    Properties

    addRow: (params: XUtilOnAddRowData) => void

    When a row with a repeated element or container was added.

    Type declaration

    afterLoadFormData: (params: XUtilOnAfterLoadFormDataData) => void

    A callback for when form data was loaded via $.xutil.load. This callback is invoked after the form data was loaded and the form was updated with the new data. You can use this callback to perform additional actions after the form was loaded, such as updating the UI of rich widgets.

    Type declaration

    afterPrint: (params: XUtilOnAfterPrintData) => void | Promise<void>

    A callback for printing the form. The callbacks are invoked after a form was printed (such as by the print service). You can use this callback to undo preparations made by print.

    Type declaration

      • (params: XUtilOnAfterPrintData): void | Promise<void>
      • Parameters

        Returns void | Promise<void>

        A promise that resolves the cleanup is done.

    afterSaveFormData: (params: XUtilOnAfterSaveFormDataData) => void

    A callback for when form data was saved via $.xutil.save. This callback is invoked after the form data was saved. You can use this callback to perform additional actions after the form data was saved, such as inserting additional data into the form data.

    Type declaration

    beforeAddRow: (
        params: XUtilOnBeforeAddRowData,
    ) => void | XUtilOnBeforeAddRowResult

    Before a row with a repeated element or container is added.

    Type declaration

    beforeClearAll: (params: XUtilOnBeforeClearAllData) => void

    Before the values of a set of form elements are cleared.

    Data with the form element.

    beforeDeleteRow: (
        params: XUtilOnBeforeDeleteRowData,
    ) => void | XUtilOnBeforeDeleteRowResult

    Before a row with a repeated element or container is deleted.

    Type declaration

    beforeLoadFormData: (
        params: XUtilOnBeforeLoadFormDataData,
    ) => void | XUtilOnBeforeLoadFormDataResult

    A callback for when form data is about to be loaded via $.xutil.load. This callback is invoked at the beginning, before any other form data was loaded. You can use this callback to perform additional actions, such as adjusting the DOM or inserting additional form data. You can also use the return value to exclude certain elements from the default handler that loads all data for .XItem elements.

    Type declaration

    beforeResetAll: (params: XUtilOnBeforeResetAllData) => void

    Before the values of a set of form elements are reset to their default values.

    Data with the form element.

    beforeSaveFormData: (
        params: XUtilOnBeforeSaveFormDataData,
    ) => void | XUtilOnBeforeSaveFormDataResult

    A callback for when form data is about to be saved via $.xutil.save. This callback is invoked at the beginning, before any other form data was saved. You can use this callback to perform additional actions, such as adjusting the DOM or inserting values into the form data. You can also use the return value to exclude certain elements from the default handler that saves all data from .XItem elements.

    Type declaration

    clear: (params: XUtilOnClearData) => void

    When the value of a form element was cleared.

    Data with the form element.

    deleteRow: (params: XUtilOnDeleteRowData) => void

    When a row with a repeated element or container was deleted.

    Type declaration

    disable: (params: XUtilOnDisableData) => void

    When a form element was disabled.

    Data with the form element.

    enable: (params: XUtilOnEnableData) => void

    When a form element was enabled.

    Data with the form element.

    fileChange: (params: XUtilOnFileChangeData) => void

    When a file was changed, both for normal and for automatic upload elements.

    Data with the form upload element.

    hide: (params: XUtilOnHideData) => void

    When a form element was switched from visible to hidden.

    Data with the form element.

    loadNavigation: (
        params: XUtilOnLoadNavigationData,
    ) => void | XUtilOnLoadNavigationResult

    When the current navigation state is restores, e.g. which pages are currently shown. Listeners can restore custom state that was saved via the saveNavigation event. The navigation state returned by listeners for saveNavigation is passed as an argument to the loadNavigation event.

    Type declaration

    print: (params: XUtilOnPrintData) => void | Promise<void>

    A callback for the print service. The callbacks are invoked when just before a form is printed (such as by the print service). You can use this callback to prepare the form for printing. When the callback returns a promise, the print service waits for the promise to fulfill before printing the form. When the promise is rejected, the error is logged, but does not prevent the print.

    To clean up after printing, use afterPrint.

    Type declaration

      • (params: XUtilOnPrintData): void | Promise<void>
      • Parameters

        Returns void | Promise<void>

        A promise that completes when the preparations are done.

    readOnly: (params: XUtilOnReadOnlyData) => void

    When a form element was set to read-only.

    Data with the form element.

    resetAll: (params: XUtilOnResetAllData) => void

    When a set of form elements hda their values reset to the default values.

    Data with the form element.

    saveNavigation: (
        params: XUtilOnSaveNavigationData,
    ) => void | XUtilOnSaveNavigationResult

    When the current navigation state is saved, e.g. which pages are currently shown. Listeners can return custom state to save. Can be used in conjunction with the loadNavigation event to restore the state later. The navigation state returned by listeners is passed as an argument to the loadNavigation event.

    Type declaration

    show: (params: XUtilOnShowData) => void

    When a form element was switched from hidden to visible.

    Data with the form element.

    submit: (params: XUtilOnSubmitData) => void | XUtilOnSubmitResult

    A callback for when the form is submitted. Can be used e.g. to run additional actions or to prevent the submission.

    The callback is called after the form was validated, if the submit button requires validation.

    $.xutil.on("submit", () => doSomething())

    $.xutil.on("submit", ({submissionBlocked}) => {
    // Check if the submission is already blocked
    if (submissionBlocked) {
    return;
    }

    // Custom code to be run on submission
    // Custom logic to check whether the form submission should be cancelled.
    const preventSubmission = customLogic();

    return { preventSubmission };
    });

    Type declaration