It's probably more typing than my solution because of the number of
onClick handlers I'll have to add
Not sure if you can do it in your context, but instead of calling the JS function in all buttons onClick, you could just call it in the FORM onSubmit...