customisedFieldsValue example 2
In this example if the value of Numera Pratica field === 'test' then the creationDate value should be '09/05/2024', otherwise '01/05/2024'
[
{
"formName": "formName_01"
},
{
"groups": [
{
"groupName": "Informazioni Generali",
"tabName": "Dati pratica",
"tab": true,
"column": true,
"content": {
"rows": [
{
"name": "firstRow",
"column": true,
"fields": [
{
"Type": "date",
"id": "creationDate",
"label": "creation Date"
},
{
"Type": "string",
"id": "claimNumber",
"label": "Id Pratica",
"visible": true,
"readOnly": false,
"customisedFieldsValue": {
"condition": {
"value": "test",
"operator": "==="
},
"then": [
{
"Type": "date",
"id": "creationDate",
"value": "05/09/2024"
}
],
"else": [
{
"Type": "date",
"id": "creationDate",
"value": "05.01.2024"
}
]
}
}
]
}
]
}
}
]
},
{
"conditions": []
}
]
<!DOCTYPE html>
<html lang="en">
<head>
<!-- load plugin style -->
<link
href="https://plugins.wedat.eu/form-builder/plugin.css"
rel="stylesheet"
/>
</head>
<body>
<!-- this place where plugin will render -->
<div class="plugin"></div>
<!-- load plugin JS synchronously -->
<script src="https://plugins.wedat.eu/form-builder/plugin.js"></script>
<!-- init plugin options on your JS file or inline JS like this -->
<script>
window.FORM_BUILDER.init({
selector: '.plugin',
onComplete: (res) => {
// make what your want :)
console.log(res)
},
data: [
{
formName: 'formName_01'
},
{
groups: [
{
groupName: 'Informazioni Generali',
tabName: 'Dati pratica',
tab: true,
column: true,
content: {
rows: [
{
name: 'firstRow',
column: true,
fields: [
{
Type: 'date',
id: 'creationDate',
label: 'creation Date'
},
{
Type: 'string',
id: 'claimNumber',
label: 'Id Pratica',
visible: true,
readOnly: false,
customisedFieldsValue: {
condition: {
value: 'test',
operator: '==='
},
then: [
{
Type: 'date',
id: 'creationDate',
value: '05/09/2024' // MM/dd/yyyy
}
],
else: [
{
Type: 'date',
id: 'creationDate',
value: '05.01.2024' // MM.dd.yyyy
}
]
}
}
]
}
]
}
}
]
}
],
options: {} // page options
})
</script>
</body>
</html>