Cannot Drag custom components
Hi,
We are trying to create custom components and find the components created cannot be dragged.
Steps to re-create
- http://formio.github.io/formio.js/app/examples/customcomponent.html
- Try creating 2 check box components
- Try dragging one on top of other
- Builder will show the change, but render component does not show the change
- In the image below, the render and builder component shows different component order

What is happening
in WebFromBuilder.js ln: 938 if (element.component) returns as null for a custom component upon drag after initial setup.
Please help. Thanks
This is working for me... Please provide a jsfiddle of the problem.
Hi,
Please find the fiddle below
http://jsfiddle.net/152hq/rj8403d9/3/
Steps
- First create a 2x2 matrix checkbox
- Then create a 1x1 matrix chechbox
- trying moving 1x1 matrix to the top
- The builder component will show the dragged object, while the Rendered Form will not. (check the console and you will see a warning "No element.id defined for dropping")

Looks like there is a missing event when dragging the custom component. If you edit one of the components it updates and fixes.
yes, but if a form has custom components, it really affects the layout . Is there a fix for this? We have worked out a solution by appending the below code as last line in the build function to fix this. Please let us know if there be a better solution
this.element.component = this;
Thanks
Can you create a pull request with this fix in place so that it works for everyone else?
Sure, will do. Do we include checkbox matrix component?
No, don't include the checkmatrix component in your pull request.
but, this is something which needs to be addressed while creating a custom component, how do I go with that then?
I think that this change should be included in the core library so that any other custom component created would have this set and then not be required to set it within the custom component itself. Is there not a way to provide the code you did above to the point after the component is created?
yep, working on your point. Will update with possible solution asap.
You must set an Id for first tag in custom component. like this
CheckMatrixComponent.prototype.build = function () {
this.element = this.ce('div', {
class: 'table-responsive'
});
//for all CheckMatrixComponents need unique id like "testid"
this.element.setAttribute('id', 'testid');
//some code
this.element.component = this;
};
Hello! Anyone know why https://formio.github.io/formio.js/app/builder PDF builder does not work? Drag and dropping fields not working this is only happening for Chrome on MAC.
@mujtaba1016,
We will take a look and see why this is happening. We created a ticket and have added it to our backlog. We welcome a PR or have a process to expedite this issue. For reference, the ticket number is PDF-159.
We will let you know once this issue has been resolved.