kevinchappell / formBuilder

A jQuery plugin for drag and drop form creation
https://formbuilder.online
MIT License
2.59k stars 1.37k forks source link

BeforeRemove event #1568

Open chuckvincent opened 2 weeks ago

chuckvincent commented 2 weeks ago

Description: Is there a way to add an event before the removal of a field that could stop the removal based on some logic. Similar to the onremove User Event, but I can not find a way to stop the removal once this event is fired.

Environment Details:

Expected Behavior

Actual Behavior

Steps to Reproduce

Screenshot - (optional)

lucasnetau commented 2 weeks ago

That's a useful feature request.

In the mean time you could try attaching an event handler to the delete button click event and prevent it bubbling up to the stages handler in formBuilder

$('.delete-confim').on('click', e => {
    e.stopImmediatePropagation();
...
chuckvincent commented 1 week ago

Thanks for the hint, but I am using a function to create the form so I am unable the register an event handler when the page loads for a class that does not exist. I am NOT a JS expert, is there a way around this?