Can a DropArea have multiple data types?

I have installed the Drag/Drop plugin. I’m building an app similar to a blog builder. As such, I have a data type “Section” with a field “Type”. The type data field is an option set with different section types, including text, photo, video, etc. At the top of the page is a group of icons corresponding to each section type.

I would like users to be able to drag and drop an icon into the blog and create a new section at that index in the repeating group. This works fine and I’m having no issues with that. Furthermore, I would like users to be able to drag and drop to reorder the sections within the repeating group. This also works fine on its own.

The issue is that both of these events share the same DropArea. Therefore, I would like to have two different workflows. For example: when DropArea has a group dropped on it (type of thing: section type), create a new section. when DropArea has a group dropped on it (type of thing: section), make changes to section’s index.

I have my workflows set up like this and it appears to work. When a section type is dropped, it creates a new section; and when a section is dropped, it changes that section’s index. However, an error appears both in the debugger and the console saying there is a mismatch in the data type. So while I’m getting an error, the workflow still runs as desired. Should I expect this behavior to work consistently, or will it eventually cause problems? Is there a best practice for establishing multiple data types in the workflow for a DropArea?

Alternatively, is it possible to expose the data type of the group currently being dragged? If it is, I could set up two invisible DropAreas with different data types, and only should one drop area when the group that is currently being dragged matches the DropArea’s data type.

Thanks!

1 Like