How to add custom javascript to a form submission?

I added the interaction:

I added 2 types of code and none of them seem to execute. Nothing happens.

The code:

Am I doing something wrong?
The documentation is extremely vague on what to do and there aren’t any normal tutorials that touch on this.

Main thing what I want to do is download a file upon submitting the form.
Custom Action in the functions.php worked, but not the frontend interaction.