Topic: Unable to properly clone form with select

mmmarkk01 priority asked 2 years ago

Expected behavior:

When using cloneNode() to duplicate a form I would expect the <select> to keep its options.

Actual behavior:

The <select> functionality breaks and no options can be selected.


Press the 'Add formset' button in the snippet to see the bug:

Dawid Wajszczuk staff answered 2 years ago


It won't work because you are copying Select elements which where generated via our script. They will still have the same ids. And you will not get options wrapper which is being render outside your form. Which is why you don't have options to choose from. You did not copy this part, which again will have the same ids.

You need to make new select for each form. If you want the same options, just create options object and pass it to these selects via JS.

Keep coding,

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 3.10.1
  • Device: PC
  • Browser: Edge
  • OS: Windows
  • Provided sample code: Yes
  • Provided link: Yes