What are you trying to do? This looks very messy. First of all, both forms have the same name. In the world of Netlfiy form handling this is a no no. Secondly, what exactly is the first form for? Looks like it’s a placeholder. If not, why not have those fields as part of the actual form with type=hidden? Third, your javascript at the end manipulates a form that seems to be created AFTER the manipulation is done.
Long story short: Whatever Marketo might be, you should post this request in their support forum. Then formulate the issue at hand better, if it still doesn’t work. If the “supplied code” does not do what you think it should do (on it’s own, without whatever you tried) then what exactly is the error?
For a start it would be of interest if “marketo” is creating the form or handling the form response. In how far is Netlify required for the form?
You typically have error messages in the browsers console thrown and I assume there are plenty of them in this case. But I am relatively sure that this is a general issue and not one Hugo did do.
Marketo is Adobe’s marketing automation tool (SalesForce of sorts). As far as forms go, you create one on Marketo (eg download a white paper) and it tracks and triggers different things when the user comes back to the site. It works fine on a dynamic site like WordPress but I can’t figure out how to make it work with Hugo/Netlify.
as per Netlify’s how-to, knowing it won’t work because of type=hidden which is why I tried the JS code in my original post.
So I wonder where do I put <input type="hidden" name="form-name" value="name_of_my_form" />? I’m confused by JavaScript-rendered form since rendering is done by JS outside of Netlify.
Why would you want Netlify to handle form input when Marketo is the one handling form inputs ? As per the form examples, even adding form hidden elements is handled by Marketo. Netlify doesn’t need to process anything, other than just render the form. The form values will be available in your Marketo dashboard.
This is neither a Netlify nor a Hugo issue. You need to check your Marketo code.