I have a form with a date selector field where I set (static) min (-10y) and max (-3y) dates. But I have also defined custom validations for more exact error messages. But in testing I only see the system standard error message (Datum muss zwischen 11.03.2015 und 11.03.2022 liegen.) and not my custom ones when I leave the min and max dates in - when I remove them the custom validations work fine, but of course the disadvantage of this is that the date picker is not restrained to the valid time slot anymore. Question can I do both (have min and max dates) and see my custom validations or do I have to choose one of them? I think the issue is that the default check happens before any custom ones (I have given them the lowest sequence possible (0) but no use) and then the custom ones are ignored, but I don't know how to prevent this.
Your observation is correct. The issue is that there are client-side validations and server-side validations. They have a different execution point which I agree can cause confusion. It's not possible to change the order in which they are executed.
The client validations are declarative attributes (eg the "value required" attribute of an item or the date attributes you mention) and are executed before the page is submitted.
The validations defined in the "Processing > Validating" section are the server-side validations. Those are executed after the page is submitted.
The behaviour is that when a user submits the page, first the client side validations are performed. If any validation fails, processing does not continue. Only when all client side validation pass, the page is submitted and the server-side validations are processed.
I'm pretty sure you cannot do both and define both a declarative validation and a server-side validation for the same condition. This is because the custom validation is only fired if the client-side validation passes.
What you could do however, is modify the system error message that is generated by the client-side validation.
To do this, follow the following steps:
2. Determine the message name of the message. Open browser dev tools, navigate to source and look for the js_messages file. In that file, search for the message:
In this case, the message is APEX.DATEPICKER.VALUE_MUST_BE_BETWEEN
Notes: