-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicate Rendering of Fields/Labels When Setting Form Submission on Initial Load #5598
Comments
Hi @fuadkhan1996 thanks for reporting this, although I'm unable to reproduce this issue using version 4.19.2. Can you fork the JSFiddle I've provided and help us out with a minimal reproducible example? |
Wanted to post this as I also ran into the issue and found a solution. I was originally assigning the data in the same way and was able to replicate the problem, I changed my code to loop through all my properties in the source object and simply assign them. I am wondering if the cause is something to do with when your assigning this way and you have a missing property in your source it makes form.io think its missing and it readds it when rendering. In my specific example it was HTML components which we didn't have in the form JSON data. Before
After
|
Hi @jamie-steele would you be willing to post your custom component ? |
Hi @brendanbond, I have the example set for you. I don't know what the possible solution can be but this is the bug in all the versions starting from 4.19.2. |
Hey @fuadkhan1996 you can find more details about this issue in the description for #5792 - the markup in your HTML component is invalid, which causes the renderer to miss the attach phase for the first pass and just pop it into the DOM outside of any formio containers. Change the parent element to something like |
The issue happened because the markup in the HTML component is invalid. The "p" tag could not be used with children elements like: address, article, aside, blockquote, details, dialog, div, dl, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6, header, hgroup, hr, main, menu, nav, ol, p, pre, search, section, table, or ul. Form.io changed its default parent tag from p to div: formio/formio.js#5792 Similar issue and developer explanation/recommendation: formio/formio.js#5598 (comment) Found some other issues not reported in the ticket as this one:  - Checked all form.io forms; - Changed the "p" tag to "div" when the component had invalid children tags for paragraph; - Changed some other invalid HTML found when doing the check.
Describe the bug
After updating to the latest version of Formio.js, I am experiencing an issue where form fields and labels are rendered twice when setting the form submission data during the initial load of the form. This issue occurs consistently when using the
this.form.submission = { data: data }
method right after creating the form. Removing this line results in the form rendering correctly, suggesting that the issue is directly related to setting the submission dataVersion/Branch
4.19.2
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Setting the form submission data should only update the form fields with the provided data without causing any additional rendering issues.
Screenshots


Additional context
The form fields and labels are duplicated, indicating an extra rendering process is triggered when the form submission is set on the initial load. It's working fine on version
4.16.0
.The text was updated successfully, but these errors were encountered: