Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

GUI Hooks

Phat Tran edited this page Sep 26, 2018 · 1 revision

How to define hooks for Form Builder GUI

Pass into the options property:

<form-builder type="gui" v-model="formValues" :form="formConfigData" :options="formBuilderOptions"></form-builder>

With your option hooks like this:

data() {
    return {
        formBuilderOptions: {
            hooks: {
                'Section.beforeRegister': function(sectionInfo) {
                    // action here, you can use sectionInfo object...
                }
                ... // more hooks below...
            }
        }
    }
}

Available Hooks

Hook Name Passed Parameters Description
Section Hooks
Section.beforeRegister object sectionInfo Before a section will be render.
Section.afterRegister object sectionInfo After a section has just rendered.
Dynamic Section Hooks
DynamicSection.beforeInitClone object/array cloneSectionData Before form builder cloning the section data for duplicating.
DynamicSection.beforeAddInstance object sectionInfo Before add new clone instance.
Return false to stop adding process.
DynamicSection.afterAddInstance object sectionInfo After a new instance has just added.
DynamicSection.beforeRemoveInstance object sectionInfo Before remove a specific instance.
Return false to stop removing process.
DynamicSection.afterRemoveInstance object sectionInfo After a specific instance has just removed.
Control Hooks
Control.beforeRegister object controlInfo Before a control will be rendered.
Control.afterRegister object controlInfo After a control has just rendered.
Control.afterInit object controlInfo, jQuery controlSelector After initiated a control.

Your needed hook doesn't available? Contact me. If it's worth to create, I would gladly create a new specific hook for you :D