This page explains step by step how to set this up.
https://docs.mendix.com/refguide/setting-up-data-validation/
Essentially, when you submit the page you trigger a microflow. This microflow validates the data. If the validation is successful it shows the next page. If it is invalid, then it shows validation feedback messages on the current page to help the user add the correct data.
I hope this helps.