Invalid Form Field Path issue with Form2 Forms

While editing the form2 form from patient dashboard, we are getting the below error.

After analysing the code, we see that it’s the issue with form field path that got generated for a specific control(here section control).

Whenever we load the form2 form from the consultation page, for some of the controls its generating invalid format of formFieldPath. While we load the form from consultation page and if we enter the obs for control id which has invalid formFieldPath, then this formFieldPath will get saved to database. While editing the form from display control then its throwing the error that shown as shown in the above screenshot . We are still trying to figure it out how it’s generating invalid formFieldPath.

Eg: Invalid FormFieldPath - Initial Medical Examination.2/80-/139-0

Valid FormFieldPath - Initial Medical Examination.2/8-0/139-0

And this is not happening every time we load the form. Its to intermittent. We see that recreating the from(by republishing, sometimes drop the section and add the section which had the problem) solving the issue.

We would like to discuss the approach we have taken to fix the issue. @angshuonline @gsluthra @buvaneswariarun @swedhan @muhima08 @thomasrod @vmalini

1 Like

Below is the technical approach that we have tried to fix the issue

  1. Have a regex check while loading the form from consultation page. This would ignore the invalid formFieldPath that got generated by any chance and the control wouldn’t render in the UI.
  2. Have the regex check in the backed before saving the formFieldPath to the database.

@angshuonline @gsluthra @buvaneswariarun @swedhan

@binduak Can you share the link to Github code where the form-field paths are being generated?

@gsluthra you can find the logic in the below file.

And the form field path gets generated while we load the form in the consultation page.

  1. not sure about checking on the backend.
  2. First time itself, we ought to ensure that the formfieldPath is properly set. And you might want to have better validation about it.
  3. Any idea how this bug might have come about?


I am thinking UI valid is must and along with it we can have backend validation too


not sure. We couldn’t find the root cause as the issue is not consistent. But re-publishing the form has solved the issue and we no longer see the invalid form field paths.

was this ever imported?

no @angshuonline we have recently upgraded from 0.91 to 0.92. So we have not imported the form but we restored the database and forms. This could be the reason for the issue.

Do you think having the formFieldPath validation would make sure that we don’t get into this issue ?