Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


The pui.onload validate event, if defined, fires after each Rich Display Record Format is rendered.  It is executed right before the screen's onload event.The pui.onload method does not fire on Genie screens.  For Genie screens, use the global customize() and afterLoad() events insteadfor each field that is modified on a Rich Display File screen and submitted back to the server.

The event can change the value being sent to the server by returning a new value as a string.  However, this would prevent any normal Profound UI formatting to occur.

The event can bubble up to normal Profound UI formatting by returning null.

The event can both change the value being sent to the server and bubble up to normal Profound UI processing by modifying the "value" property on the parameter passed to the event and returning null.

The event can cause a validation message to occur by returning an object with a property named "msg", which will contain the message to display.

Parameters:

The pui.onload validate event receives one parameter object that has the following properties:

  • file - display file name
  • library - display file library
  • name - record format name
  • metaData - meta data for the screen definition, including screen-level properties and properties for each element
  • data - name/value pairs of the data rendered on the screen
  • ref - reference field information object

Example:

...

  • value - the value being submitted to the server; this can be changed by the event
  • fieldName - the name of the field being modified
  • dataType - the field data type
  • dataLength - data length (only present if the field is a character or a numeric field)
  • formatting - field formatting

Example:

The following code looks for invalid characters in all character input fields.

Code Block
javascript
javascript
pui.validate = function(obj) {
  var invalidRegExp = new RegExp("[^A-Za-z0-9`-~!@#\\$%\\^&\\*\\(\\)_\\+\\{\\}\\[\\]\\|\\\\:;\"'<>,\\.\\?/ =]", "m");

  if (obj.dataType == "char") {
    // Position the footer based on the current screen height replace tab and quote characters pasted from MS Word with standard characters
   var footerobj.value = getObj("myfooterobj.value.replace(/\t/g, " ");
    obj.value = obj.value.replace(/\u201C/ get a reference to the footer div
  var footerTop = pui.getRuntimeContainerHeight() + 20;  // calculate footer top position based on runtime container height
  footer.style.top = footerTop + "px";  // assign the new top position
g, "\"");
    obj.value = obj.value.replace(/\u201D/g, "\"");
    obj.value = obj.value.replace(/\u2018/g, "'");
    obj.value = obj.value.replace(/\u2019/g, "'");

    if (invalidRegExp.test(obj.value)) {
      return {
        "msg": "The field contains invalid characters."
      }
    }

  }

  return null;
}