formio / formio.js

JavaScript powered Forms with JSON Form Builder
https://formio.github.io/formio.js
MIT License
1.89k stars 1.06k forks source link

[Bug] Any control's Lable field is rendering the html tag #5443

Closed copaliwal closed 10 months ago

copaliwal commented 10 months ago

Environment

Steps to Reproduce

  1. Create a form with any control
  2. In the display tab, add the below HTML in the Lable field <img src='#'>
  3. It renders the HTML at the label place

Expected behaviour

The HTML tag must be displayed as text and should not be interpreted.


Screenshot

image

Full screenshot

image

travist commented 10 months ago

I am all but certain that this is the DOM purify routine that is stripping out the html. There is a way to configure the tags so that it will accept IMG within the renderer. Something like this may work.

Formio.createForm(document.getElementById('formio'), '.....', {
  sanitizeConfig: {
    addTags: ['img']
  }
});