Form onsubmit vs. Form action

What is the difference between form onsubmit attribute and form action attribute?

Hey Temima
onsubmit is not an attribute for the <form> html tag. Where did you see that?
MDN - attributes_for_form_submission

It worked for me when I tried to send info to different routes in my web app.

I’d suspect is something specific to your web app. Are we talking React-based?

Nope, I’m using flask

So this was actually a very interesting question indeed.

As I wrote before:

onsubmit is not an attribute for the <form> html tag. Where did you see that?
MDN - attributes_for_form_submission

MDN also explains what onsubmit is:

But it shows that it’s an event handler, so manageable only through JS:

What are the available events?

Events are documented in and/or below the pages for the JavaScript objects that emit them

However, on W3S the explanation is quite different:
https://www.w3schools.com/tags/ref_eventattributes.asp

which roughly says:
“onsubmit is a global event attributes that can be added to HTML elements to define event actions”.

I wonder if there’s any security concern of having those event handlers as html attributes, instead of eventListeners in JS.

Hope this helps clear your doubt.

Cheers,