admin管理员组文章数量:1394068
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.
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.
Share Improve this question asked Mar 12 at 14:46 user3284214user3284214 331 silver badge5 bronze badges1 Answer
Reset to default 2Your 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:
- Invoke the message so you can see the complete syntax:
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
- Create a text message with the same message name. This is done in Shared Components > Globalization > Text messages.
Notes:
- Make sure to set the "use in javascript" attribute to "On"
- The original message in the js file has the values \u00250 and \u00251. \u0025 is the unicode representation of '%'. When creating a text message, the % sign does not need to be escaped and the values %0 and %1 can be used (see screenshot below)
- Save, reload the page and invoke the message again. Observe the changed message:
本文标签: How to use custom validations before system ones in Oracle ApexStack Overflow
版权声明:本文标题:How to use custom validations before system ones in Oracle Apex? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744746786a2622930.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论