Custom Validator - Custom Error Message

Hi! Thank you again for this amazing tool.
Is there a chance in the future that the CustomValidator could return a "Custom Error Message"?

(bool, string) ValidateSomething(string someFieldValue)
string errorMesg = "";
bool isValid = true;

if (<condition 1>)
   errorMsg = "This value must exists in that table"; 
   isValid = false;
} else if (<condition 2>) 
   errorMsg = "This value is duplicated"; 
   isValid = false;
// and so on

return (isValid, errorMsg); 


Thank you again

I have the same needs hope see that in the future

<RadzenCustomValidator Component="Email" Validator="@(() => ValidateNewEmail(model.Email))" Text=@MessageVariable />
You can try assigning Text property of the validator content to a string variable and assign value to that variable based on your condition.

1 Like