The pui.validate event, if defined, fires for 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.validate event receives one parameter object that has the following properties:
- 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:
pui.validate = function(obj) { if (obj.dataType == "indicator") { if (obj.value == "true" || obj.value == "1") return "1"; else if (obj.value == "false" || obj.value == "0") return "0"; else return { msg: "The selection is not valid for an indicator." }; } else { // bubble up return null; } }