This Plugin will enable the conditional logic functionality.
This Extension requires the DependsOn library.
npm i jquery-depends-on
<script src="https://gistcdn.githack.com/solverat/5a70ea1b21eaff050460294094ec052d/raw/96d9e93f2f7beae8e6828ab46c8ec859d24f3bc8/dependsOn.min.js"></script>
// optional: if you've added depends-on via npm
import 'jquery-depends-on';
// required: load extension
import 'jquery-pimcore-formbuilder/dist/jquery.fb.ext.conditional-logic';
document.addEventListener('DOMContentLoaded', () => {
$('form.formbuilder').formBuilderConditionalLogic();
});
document.addEventListener('DOMContentLoaded', () => {
$('form.formbuilder').formBuilderConditionalLogic({
conditions: {},
actions: {
toggleElement: {
onEnable: function (action, actionId, ev, $el) {
console.log(action, ev, $el);
}
}
},
elementTransformer: {
hide: function($els) {
$els.hide();
}
}
});
});