sessionMessage with HTML

Silverstripe Version: 5.2

**Question: How to send HTML in a Form answer **

Documentation said sessionMessage can be send as CAST_HTML, but I’m not able to set CAST_HTML.

$form->sessionMessage('Bad answer<br>Try again', 'bad', ValidationResult::CAST_HTML);

give “Uncaught Error: Class “ValidationResult” not found”

$form->sessionMessage('Bad answer<br>Try again', 'bad', CAST_HTML);

give “Uncaught Error: Undefined constant “CAST_HTML””

What is the correct syntax ?

Thanks

You need the use statement for this class.

use SilverStripe\ORM\ValidationResult;