0

So I'm relatively new to form.io but the company I work for has a ton of forms set up. Recently there's been a strange bug when rendering submissions. It only happens on some forms and only with some components, and I haven't yet found any correlation between them. I can share more details of the forms and their components.

The bug is effectively as follows. The user opens a form, selects some checkboxes. In some cases, there are conditionals whereby selecting a checkbox might then display a text input field, e.g. 'does your shopping list contain eggs?' is a checkbox, and 'how many eggs?' would be a text input that only displays if the checkbox is ticked.

The user then submits the form. The form saves just fine in form.io, I can visit the URL of the specific submission and see that the data the user entered has saved.

The user then decides they need to make a change to the form, so they re-open it. We load their submission data and render the form with the current state of their submission. Sometimes, it loads absolutely fine with no problems. Other times, checkboxes that were checked are now unchecked. And sometimes, the checkboxes are still checked, but the conditional text input boxes are not displayed.

When I run through the code in the form rendering repository step-by-step using a debugger, I can see that the form always renders the submission perfectly, but is then re-hiding the text input field and/or deselecting the checkbox, but I can't see that anything triggers it to do that. It seems strange that it seems to happen with a consistent set of checkboxes and text input fields and not any others, which makes me think it might be an issue with how those checkboxes are configured in form.io rather than any errors in the form rendering code, but I've gone through all the settings for the checkboxes affected and made sure they are identical to checkboxes that aren't being affected, it's made no difference. Otherwise, I've spent all week repeatedly stepping through the Formio.createForm() and subsequent .then() methods of the code and I can't see anything that's causing this.

Any form.io experts out there with any ideas on what might cause such symptoms? Happy to share more details of the form.io setup and/or any relevant parts of the code!

Bill
  • 41
  • 1
  • 3
  • Can you share the form JSON? In order for us to help, consider posting a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) – Brendan Bond Nov 04 '22 at 17:00
  • Just to avoid this being left all unanswered and such... The work ended up being given to someone with a lot more form.io knowledge than me before I could post any JSON here. But from what I gather, the form in question had a nested resource with some advanced logic attached to it that was loading the form data and using that data to enable and disable checkboxes and other form components, but the logic was wrong and causing these strange bugs. Hopefully that will be of some help to others who have similar issues in the future! – Bill Nov 28 '22 at 11:04

0 Answers0