kevinchappell / formBuilder

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

Is it possible to create sections and restrict controls movement among them? #1483

Open ghost opened 10 months ago

ghost commented 10 months ago

Hi, Thank you for the amazing plugin. I would like some help with specific requirements that I have. I have predefined input sets that define specific sections of my forms like image

  1. I want to restrict the movement of the controls in this section to within this section.
  2. I want to wrap the control set within an HTML element like a special div.

Thanks.

lucasnetau commented 10 months ago

Hi @kamranAdax

Neither of the two items you have raised are currently available out of the box, however

  1. The sorting is implemented using jQuery Sortable. You could attach a class to the <li> elements on the stage that you wish to disable sorting on and then update either the cancel or items option for sortable. https://jqueryui.com/sortable/#items
  2. In non-bootstrap mode you can use jQuery to wrap a set of elements. This doesn't work right now with bootstrap mode you have enable due to some selectors breaking. I have a very early POC with container/section support however it's not ready for prime time yet.

Another option for multiple sections is to create multiple instances of formBuilder, one for each section. Then render them in order with formRender