Field Events
About

Events

It is used to configure custom behaviour for fields with certain events and actions.

Properties

NameDescriptionValue
changeThis indicates a change event'change' object
OR
a list of 'change' objects
clickThis is called on click over the field'click' object
OR
list of 'click' object
openThis is applicable to 'select' field and triggers when dropdown is opened'open' object
OR
list of 'open' objects
inputThis is applicable to text boxes and triggered when input is entered'input' object
OR
list of 'input' objects

change event properties

This event is emitted whenever there is a change in the value of the field

NameDescription
typeIt refers to the type of action to perform on this event
refreference to the name of another field where action is to be performed.
Not required if the action needs to be performed on the same field
sectionrefers to the form section name (in case of grouped form)
nameThe name of the property to be used
valueThe value to be used
valueFnA function to be used to get the value of the field
valueMapA map of values to be used
valueKeyUsed for select field which fetches data from remote and contains the data of the response in the memory.
valueKey here refers to one the value from the response key to be used as value
payloadThis is payload data used for type event_emitter

type properties

NameDescription
propSetterUsed to set a property of the field
setterUsed to set the value of the field
eventEmitterUsed to emit a global event
setterConditionUsed to set the value of the field based on some condition

Event Emitter properties

Following is a list of internal events which can be used to implement advanced form behaviours.

Event TypeDescription
$end_of_pageUsed to set the last page in a group form
$reset_end_of_pageUsed to reset the last page in a group form

Example usage

{
    "events": {
        "change": [
            {
                "type": "event_emitter",
                "eventType": "$end_of_page",
                "payload": {
                    "value": 3
                },
                "value": "new"
            },
            {
                "type": "event_emitter",
                "eventType": "$reset_end_of_page",
                "payload": "",
                "value": "renewal"
            }
        ]
    }
}

Star us at github

© Copyright 2023 MuiForms