Form is not detected when using JavaScript to set action attribute

Hi,
I am trying to set up a form using netlify by following the examples.
The form worked totally fine when is used this tag:

So my site navigated to “index0” page after the submission, and submissions are also recorded in netlify UI.

Now I want to set the “action” attribute with javascript using the tag:

with my function:

function func(){
window.location= "index0.html";	
}

In this case, my pge is navigating but submissions are not recorded in Netlify UI.

Can you please help me in this regard?
Thanks

action attribute should not be a JavaScript code. You should attach an event listener to your form.

1 Like

Thanks for the help. It worked! thanks for the help

Hi @Faizan :wave:t6: , thanks so much for coming back and letting us know this resolved your issue we appreciate the feedback!