Require work email for form submit

I tried the steps in this older thread and nothing is working for me: Adding custom validation to form fields

I have a pop-up form, is there anything different I need to do in the code to make a pop-up form work? Are there updates to the code that need to be made to make this work in 2020?