Drag & Drop with parameter

Asked

Viewed 256 times

1

I am making a dynamic form. Where there is a button that adds the field type (Date, Time, Text, Email, etc). And I wanted to sort these fields with drag and drop. I would need you to return the position of the fields, because I will save the order, type and values in a bank.

The user will be able to create various types of forms, with the fields he wants, and then, at the time of listing, would have to display the fields in the order he left with the drag and drop.

Currently my code is already creating the fields, and saving in the bank. But without the possibility of the user to order. Ai would have to add one more column in the BD to know the position the plugin returns.

Does anyone know any plugin that does something like this ?

The plugins I found so far, form build did not show the position of the fields.

1 answer

0

Jquery itself can sort the elements with Draggable. See an example of the functionality:

https://jqueryui.com/draggable/#sortable

Then you take a list of the elements and send it to the backend. It will already be sorted in html with Draggable, so you can send the position according to the css/xpath of the field, picking which element number it is

Browser other questions tagged

You are not signed in. Login or sign up in order to post.