DEV Community

Cover image for Uncaught (in promise) ReferrenceError: Cannot access 'formData' before initialization at HTMLFormElement.<anonymouse> (solution)
Osman Forhad
Osman Forhad

Posted on

1

Uncaught (in promise) ReferrenceError: Cannot access 'formData' before initialization at HTMLFormElement.<anonymouse> (solution)

I was working with a javascript form submission. but I got this error which is like below:
Alt Text
I was trying to solve and search this type of error why happen.
finally, I find out the point why this is happening: this is happening because I write the variable name and the instance name are the same spelling: which is like below screenshot :
Alt Text
and after that, I do the correction in instance name spelling which is like below screen-shot:
Alt Text
and now it's working nicely there is no error/warning. please see below:
this is my browser console screen-shot:
Alt Text
see there is no warning.
and again see the network tabs screen-shot of my browser:
Alt Text
this is a show a success message.
.
that's it.
.
Happy Coding.
osman forhad
Mobile & Web Application Developer💻

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

Top comments (3)

Collapse
 
crnfx profile image
Roman

U are my hero! Thank's a lot!

Collapse
 
meghannfh profile image
Meghann

Your post saved me so much trouble!! Thank you!! :)

Collapse
 
andreacbc profile image
andreacbc

Thanks, I had the same mistake :)

AWS GenAI LIVE image

How is generative AI increasing efficiency?

Join AWS GenAI LIVE! to find out how gen AI is reshaping productivity, streamlining processes, and driving innovation.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay