formio / formio.js

JavaScript powered Forms with JSON Form Builder
https://formio.github.io/formio.js
MIT License
1.83k stars 1.04k forks source link

I have set confirmation before removing component of formio form builder. confirmation dialog showing but when i cancel its still remove component #5541

Open parmodkumarr opened 3 months ago

parmodkumarr commented 3 months ago

builder = await Formio.builder(document.getElementById('builder'), value, {}) builder.on('removeComponent', function(component) { if (!confirm("Are you sure you want to remove this component?")) { return false; } });

lane-formio commented 3 months ago

Could you please provide some more information? What version are you using? Could you provide an example (like via jsfiddle) or supply a video?

parmodkumarr commented 3 months ago

I found the solution configure alwaysConfirmComponentRemoval:true in options like this

builder = await Formio.builder(document.getElementById('builder'), {}, { alwaysConfirmComponentRemoval:true });

But, I want to like sweet alert not window confirmation dialog please let me know if we can modify removeComponent functionality

jsfiddle link:

https://jsfiddle.net/parmodkumar/vw35z74h/2/