There is a new little known sorta feature in APEX 5.1 called client-side validation. You may have missed it because it is not listed in the release notes under new features and only mentioned cryptically, almost tangentially, in the release notes section “Compatibility Mode Changes in Mode 5.1”. It says
“… buttons where the Execute Validations attribute is set to Yes also perform some client-side validations (such as item required checks) and will not submit the page until all issues are fixed”
Other hints and evidence for this feature are the new apex.page.validate
function, the validate option to apex.page
namespace submit
and confirm
functions, and the new apex.item getValidity
and getValidationMessage
functions.