I developed a form field to display a custom captcha solution. It works fine, except when I try do edit the field. Every time I click on edit a new widget is appended to the form editor. Also, I cant delete the field, while I haven’t saved the form with the new field for the first time (because $request->isXmlHttpRequest() is false, why?). I looked at the FieldController where the field is rendered and passed back to the Ajax request. After saving the form the duplicates are gone and the form works fine. But I cant figure why my custom field behaves that way. Any ideas?
In case you would like to have a look at the repository, it’s here.