Ab.net's avatar

Laravel create and edit dynamic forms via a drag and drop interface

Hello Awesome people :) I wanted all my forms to be dynamic except the save and update buttons. let say there is a customer creation from and if an admin wanted to add or remove a field he can do it from a drag and drop builder next to the form. can you suggest me anything on how to do this? Thanks in advance :)

0 likes
1 reply
automica's avatar

As part of a project for a client a few years back, we were faced with a similar challenge to allow a site editor to build forms that allowed fields to be added and changed.

The challenge with this is to store the schema in such a way that the additional fields added could also be retrieved when viewing the saved data.

Additional concerns related to if someone had added data and the field that they had added into was subsequently removed from the form. Do you see that data? Also if you change the label on the input, could that change the context of the answer.

Also, how do get an report out when customers have a different amount of fields filled out when they were created? Over time you’d might make changes on your form and this would get worse as my original form with 5 fields could balloon to 20.

Whilst form builders exist in cms frameworks such as Drupal or Wordpress, the table structure behind them are pretty complex and don’t deal with form versioning very well.

I’m not sure what the answer is for you without looking at your requirements in more details. I do know it’s a difficult task to make something truely dynamic.

We were looking at non js solution do didn’t do drag and drop although we did reference google form builder for hints on how to define fields and also to store the form schema. We build a package for laravel 5.4 but it’s a not been updated for other versions since the client since moved to a different solution.

It may be something achievable in Vue nowadays with the results serialised into a json field.

My approach now would be to descope the functionality as too expensive and just use standard laravel/web forms.

Please or to participate in this conversation.