Manually set validation error

is there a way to manually set/trigger a validation error via JS like in the image below?

Screenshot 2023-11-06 at 00.29.35

Welcome to the forum!
Yes this can be done in JS, but what is the use case? Since this can easily be done in a component built into rRetool, why implement it manually?

Forgot to update this thread. We ended up using a different approach. Thanks for the help @ScottR