Jet\Form_ValidationError
The class represents a form field validation error.
Instance is convertible to string.
Finally, the error can be converted to JSON, so error messages can be easily sent in REST API responses.
Method | Meaning of |
---|---|
public __construct( Form_Field $field, string $code, string $message ) |
Parameters:
|
public getField( ) : Form_Field |
Returns the instance of the form field to which the error applies. |
public getCode( ) : string |
Returns an error code. |
public getMessage( ) : string |
Returns an error message - already translated and fully generated (complete with values). |
public __toString( ) : string |
The instance can be converted to a string. The result is an error message. |
public toJSON( ) : string |
The error can be converted to JSON format. The field will be represented by the field key and field name. |
public jsonSerialize( ) : array |
The error can be passed to the json_encode function. |