Monday, July 27, 2020

Client Side Error Messages in Oracle APEX

SAVE (button) --> Page Message (Dynamic Action) --> On Click (Event) --> TRUE event

/* General page error message */
apex.message.showErrors([
{
type: "error",
location: "page",
message: "Page error has occurred!",
unsafe: false
}
]);

/* Item error message */
apex.message.showErrors([
{
type: "error",
location: [ "page", "inline" ],
pageItem: "P7_CITYNAME",
message: "Value is required!",
unsafe: false
}
]);

/* Multi Item error message */
apex.message.clearErrors();
var chkErr = 0;
var arr = [
   'P7_CITYNAME',
   'P7_COUNTRYNAME'
];

for (var i in arr) {
  if ($v(arr[i]).length == 0) {
    apex.message.showErrors([
      {
        type: apex.message.TYPE.ERROR,
        location: ["inline"],
        pageItem: arr[i],
        message: "Value is required!",
        unsafe: false
      }
    ]);
    chkErr = 1;
  }
}

if ( chkErr == 0 ) {
  /* Custom dynamic action call when no error occurred */
  apex.event.trigger(document, 'customDA', [{customAttribute:'1'}]);
}

No comments:

Post a Comment

Delete Row Button to all records of Interactive Report in Oracle Apex

 1. add 'Delete' Del column to Report Query 2. Set the Following Properties for the DEL Column Type: Link Heading: Delete Targ...