I’m currently setting up a CMS Collection Page that will help me automate the creation of a lot of landing pages with a form, pretty standard stuff.
The catch is that each landing page needs it’s own individual form handler placed on the ACTION field in the form settings. I see there’s no way to natively be able to endow every iteration of the CMS Page with its unique form handler on the ACTION field, so I think I need to create a custom code for this.
I’ve seen in previous forum entries that this very same issue but for the dynamic REDIRECT URL has been solved with a code like this:
where the CMS-URL can be replaced with a dynamic value inside the page settings.
My question is, would this method work for the ACTION field of the form too? I’d try that myself but I don’t have the first clue about JS to tweak the code appropriately.
@EFFIQS_MARKETING - looking at your code, it looks like you are targeting the parent div by id rather than your form. Your form id is wf-form-Whitepaper-Form---DAM-Solution your code is targeting #whitepaper-form which is the parent div.
Hi Sam, it seems after correctly targeting the form block instead of the wrapper, the form submissions are still not registering on their end location. I’m sorry if I’m making another mistake but it’s the first time I need to set up a complex lead tracking system in a non-native way like this.
Hey Effiqs,
I haven’t tested dynamically changing the form action myself, but it does make some sense that in the publish process Webflow would auto-bind those forms to its own submit handler if the action is initially blank.
You can try your un-binding trick to undo that, or you can put a placeholder like # in the form action field before you publish. That should keep Webflow from binding its handler and your script can change it to whatever you like.
I’m not sure if it’s that change or not, but ever since I fill out that ACTION field with the #, it redirects to a blank page, and the form handler still does not receive the submission.
I’m currently testing the script that Sam-G very kindly helped me produce
Hi Sam, It looks like your code solved my problem, after I correctly targeted the form, the only thing missing was the need to add a # on the default ACTION value. Now it seems every submission is registering correctly.
Thank you very much Sam for your help, and Michael for chiming in!
Thank you Michael for your input, it was the missing piece together with Sam’s code, now it seems everything is working correctly, thank you very much!
I do think I get the gist of it but indeed the understanding of the code is beyond me at this point. I’m sure someone will benefit from this too. The current code sam shared is working perfectly with Michael’s addition of setting # as the default ACTION value.
I see there are many ways of solving this so if anyone encounters this in the future this thread might be useful.