trait FormMessage

Form component which contains a castable message

Methods

string
getMessage()

Returns the field message, used by form validation.

string
getMessageType()

Returns the field message type.

string
getMessageCast()

Casting type for this message. Will be 'text' or 'html'

$this
setMessage(string $message, string $messageType = ValidationResult::TYPE_ERROR, string $messageCast = ValidationResult::CAST_TEXT)

Sets the error message to be displayed on the form field.

array|null
getSchemaMessage()

Get form schema encoded message

Details

at line 42
string getMessage()

Returns the field message, used by form validation.

Use {@link setError()} to set this property.

Return Value

string

at line 56
string getMessageType()

Returns the field message type.

Arbitrary value which is mostly used for CSS classes in the rendered HTML, e.g "required".

Use {@link setError()} to set this property.

Return Value

string

at line 66
string getMessageCast()

Casting type for this message. Will be 'text' or 'html'

Return Value

string

at line 81
$this setMessage(string $message, string $messageType = ValidationResult::TYPE_ERROR, string $messageCast = ValidationResult::CAST_TEXT)

Sets the error message to be displayed on the form field.

Allows HTML content, so remember to use Convert::raw2xml().

Parameters

string $message Message string
string $messageType Message type
string $messageCast

Return Value

$this

at line 117
array|null getSchemaMessage()

Get form schema encoded message

Return Value

array|null Message in array format, or null if no message