-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Field Logic Schema
An object that contains a trigger object and an array of action objects.
logic: [
{
trigger: {}
actions: [{}, {}]
}
]
Trigger object - The trigger object contains a type and definition property. The definition property is different depending on the trigger type. When evaluated to true it will then apply the actions.
Options are:
{
type: 'simple',
simple: {
when: 'triggerFieldKey',
eq: 'Value to equal',
show: true // To trigger or not when the value is equal
}
}
{
type: 'javascript',
javascript: 'result = customJavascriptReturningFalsyValue;'
}
{
type: 'json',
json: {} // JSON Logic object that returns true or false.
}
Action object - a definition of an action to be applied to a component when the trigger evaluated to true. There are various options for the action type.
The property action will change a property on the component and then redraw the component to ensure the property change is applied.
{
type: 'property',
property: {
type: 'boolean|string', // If the property is a boolean, set 'boolean'. Otherwise set 'string'.
value: 'validate.required', // The path to the property on the component definition.
},
state: true|false // If type is boolean, set to true or false.
text: 'The text is {{ myfield }}' // If type is string, the string to assign. Can use interpolation with available variables of row, data, component and result (returned from trigger).
}
The value action will set the value of the component when the trigger evaluated to true.
{
type: 'value',
value: 'javascript that returns the new value' // Will be evaluated with available variables of row, data, component and result (returned from trigger).
}
This action is in development. It will trigger custom validation on the field.
Display Users submitted data into a table inside the admin dashboard?