Constraint
In this example the creationDate is constraint from First Date
[
{
"formName": "formName_01"
},
{
"groups": [
{
"groupName": "Informazioni Generali",
"tabName": "Dati pratica",
"tab": true,
"column": true,
"content": {
"rows": [
{
"name": "firstRow",
"column": true,
"fields": [
{
"Type": "date",
"id": "firstDate",
"label": "First Date",
"visible": true
},
{
"Type": "date",
"id": "creationDate",
"label": "CreationDate",
"visible": true,
"constraint": {
"fields": [
"firstDate"
],
"errorMessage": "bla bla error message"
}
}
]
}
]
}
}
]
},
{
"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: 'firstDate',
label: 'First Date',
visible: true
},
{
Type: 'date',
id: 'creationDate',
label: 'Return expected',
visible: true,
readOnly: false,
constraint: {
fields: ['firstDate'],
errorMessage: 'bla bla error message'
}
}
]
}
]
}
}
]
},
{
conditions: []
}
],
options: {} // page options
})
</script>
</body>
</html>