display.screen.executeMessage()

This method sends a message to a previously displayed Rich Display File screen and then waits for the user to respond or for the screen's onmessage event to automatically respond. It allows applications to update screen content without re-rendering the entire screen.

The message can be received using the record format's onmessage event.

Parameter

  • Message - the message can be supplied using any primitive JavaScript value, including Strings, Objects, and Arrays

Examples

Showing the Progress During Long Running Operations

Using display.screen.executeMessage()
// Read entire products file
productsp.positionTo(pjs.START);
productsp.fetchNext();
while (!productsp.endOfData()) {    
  display.myscreen.executeMessage("Processing product#: " + prid);
  productsp.fetchNext();
}
Sample onmessage Event
if (typeof message === "string") {
  getObj("progressBox").innerHTML += "<br/>" + message;
  pui.click();  // sends control back to server after rendering message
}

Validate Without Reloading the Screen

Using display.screen.executeMessage()
display.dataentry.execute();
var msg = validate();
while (msg != null) {
  display.dataentry.executeMessage(msg);
  msg = validate();
}
 
function validate() {
  // Server-side data entry validation logic goes here
  customersp.getRecord(custid);
  if (!customersp.found()) {
    return "You entered an invalid customer id";
  }
  return null;
}
Sample onmessage Event
alert(message);