One of the new forms we’re developing is being built with KnockoutJS. The FORM tag is made when the page loads just like normal. However, the fields inside do not appear in the DOM until the form is opened by clicking on a button.
After doing some investigation, we can see that the when the code runs the, a variable is added to the DOM element FORM tag which is set to TRUE. The variable being set is called “snowplow_cf_form”.
When you now re-run the snowplow(“enableFormTracking”) it fails to re-attach the eventListeners because this variable is set to TRUE (and of course this is the behaviour which you want in normal circumstances as we don’t want to attach more eventListeners).
So… how can we change this to work with our new forms? Can the form.js be changed to add the variable to every form field instead of the form tag?
The form.js file can be found in github.