Validation: Errors and Warnings
These messaging functions are specialized Custom Logic messages that only work with Custom Validations and while they are valid to use in the other Custom Logic types, the result will not be consistent.
setError
Sets a validation error message. This messages output in the UI if the validation logic returns false. If this function is called multiple times, only the message from the last calls is displayed.
setError(string $message)
Parameters
$message: A string containing the error message.
setWarning
Sets the validation warning message. This messages output in the UI only if the logic does not return false. If this function is called multiple times, only the message from the last calls is displayed.
setWarning(string $message)
Parameters
$message: A string containing the warning message.
setMessage
Sets the validation message. This messages output in the UI only if the logic does not return false. If this function is called multiple times, only the message from the last calls is displayed.
setMessage(string $message, string $type = 'error')
Parameters
$message: A string containing the warning message.
$type: A string type indicating ‘error’ or ‘warning’. The default is ‘error’