I am using an embedded form using the react javascript library.
The “Submit Conditionally Hidden Fields” setting is set to No. (Settings/data tracking)
BUT, when I submit my form, I can see all of my conditionally hidden questions being sent as part of the payload.
Example: These questions are visually hidden when the gender question has been answered as “Male”, but their answers are still part of the payload.
Here’s screenshot a console.log of the fields that are sent by my form on form completion, including female questions that were not visible on the questionnaire.
To give even more context, my field is visually hidden, as expected, but it’s show_logic property is somehow true, when inspecting the form completion payload.
I am using context.fields to manage the fields sent on form completion. I use these fields to map the results of the questionnaire. I was expecting to be able to rely on some property to define whether a field was conditionally shown or hidden when the user filled the questionnaire.
I understand. Is there any way to have information on whether a field was hidden or visible, on the onFormComplete event? That’s where it would make sense for us to have all the field information, because that’s the event that is use to actually process the questionnaire’s data…
that’s a harder problem because the hide/show status of a field depnds on field values at a point in time when that step was visited. However, if the field values are changed after the fact, it’s hard for us to determine if the fields were actually hidden or shown to the user at that point in time
If anyone ends up facing the same issue as me, here’s how I managed it.
I keep a dictionnary of “shown” field keys by step name, which I populate on step submission (onSubmit event), using what is in the submitFields property of the context.
On form submission (in the onFormComplete event callback), I flatted my dictionary’s values (which translates into an array of shown question keys), and I filter my context fields to only keep those that correspond to the shown question keys.