Jump to main content Jump to doc navigation

xPDOValidator::hasMessages

Indicates validation messages were generated by validate().

Syntax

API Doc: http://api.modxcms.com/xpdo/om/xPDOValidator.html#hasMessages

boolean hasMessages ()

Example

See if any messages exist for a validated object.

$validator = $obj->getValidator();
$validator->validate();

$failed = $validator->hasMessages();
echo $failed ? 'Oh noes! We failed!' : 'Success!';

See Also

  1. xPDOValidator.addMessage
  2. xPDOValidator.getMessages
  3. xPDOValidator.hasMessages
  4. xPDOValidator.validate