function::user_short_error - Linux
Overview
user_short_error(field, name)
allows you to specify a custom short error message that appears when a validation error occurs.
Syntax
user_short_error(field, name)
| Argument | Description |
|—|—|
| field
| The field to which the error message applies. |
| name
| The custom short error message. |
Options/Flags
None.
Examples
The following example shows how to use user_short_error
to specify a custom short error message for the name
field:
user_short_error(field, 'This name is too common, please choose another')
Common Issues
If you do not specify a custom short error message, the default message will be used.
Integration
user_short_error
can be used with other validation methods to create complex validation rules. For example, you can use user_short_error
to specify a custom error message for a field that fails a regular expression validation.
Related Commands
user_error
– Specifies a custom error message that appears when a validation error occurs.user_full_error
– Specifies a custom full error message that appears when a validation error occurs.