Returns a validation function to validate that a string is not null or empty if the value is required.
Optional
Indicates if the value is required.
A custom error message to display if the value is invalid.
Returns a validation function to validate that a string is not null or empty if the value is required.