That's not the intended use of front-end validation. The custom option only allows you to create an expression that will be checked.
If you want to make a custom validation, it's best to do it in a microflow, and place it under the save button.
I partially agree with Lennart. You could do the validation in a microflow in a save flow, but if you want to provide the user with immediate feedback you could also easily build an on change microflow. You can do this in the “Events” tab.
What would probably also be better and even better: use a nanoflow in stead of a microflow. Then the validation is done client side. Use a ‘validation feedback’ message to show the validation on the right attribute.
I am facing trouble doing a consistent validation. I think the correct way, like Jord said, is validating client side via nanoflow and server side via microflow. But with complex validation logic using Actions, I need to implement it either in Javascript and Java.