in previous yii2 version the script i use is working but once i updated to latest version the script have error in the yii js files and once i replace it with the old version yii.js, yii.activeForm.js and yii.validation,js, it works fine again. I'm not sure the way i code is correct or not, if I did anything wrong pls tell me. :D
this script i put in main.php
This is the error i get

You have the param e but are trying to access event which is undefined.
You'll need to change event to e.
yes i did, the error is gone, but it doesn't prevent it submit
@RookieLittle Have a look at this:
https://stackoverflow.com/questions/9347282/using-jquery-preventing-form-from-submitting
I think .on('beforeSubmit' is the wrong way to go.
Most helpful comment
You have the param
ebut are trying to accesseventwhich is undefined.You'll need to change
eventtoe.