On the "Confirm" action, there is one additional attribute option called "Validation check (PL/SQL return error msg)".
This option decides if we show a validation error as a text message. If this field is empty, the default validation check from "Component Settings" is used if it exists.
In Component Settings, we have additional options for plug-in behavior in case of a validation error.
Settings are "icon" to display and "button label".
Here is a sample use case :
if not apex_authorization.is_authorized (
p_authorization_name => 'Administrator' )
then
return 'You are not an administrator. You can not %0 this %1.';
end if;
if 1 = 1
then
return 'You don''t have permissions to %0 this %1.';
end if;
return null; -- all good
For this kind of operation, we suggest using a package in the database, as the textarea is limited to 4000 characters.
Returning text messages is also supported.
Example with a text message :
if not apex_authorization.is_authorized (
p_authorization_name => 'Administration Rights' )
then
return 'UCSWAL2.AUTH.NOADMIN';
end if;
if 1 = 1
then
return 'UCSWAL2.CONFIRM.VALIDATE.DELETE';
end if;
return null; -- all good
For this example to work, we have added the following text messages to the application :
UCSWAL2.CONFIRM.VALIDATE.DELETE > "You can not delete %1. Connected data exists."
UCSWAL2.AUTH.NOADMIN > "You are not an admin. Please contact the system administrator for more information."