DEV Community

Discussion on: How do you support detailed validation error messages?

Collapse
 
twwilliams profile image
Tommy Williams

When we have troublesome inputs, we tend to put instructions near them describing the requirements, and then just let validation handle the valid/invalid states.

Sometimes we have multiple validators, to check that a field has content at all, that it isn't too long, and that it meets the required formatting checks.

But trying to encode instructions inside the validators for all the things they check for seems like the effort:reward ratio is out of whack. It also seems like it would make a nasty little maintenance headache, too, as requirements change or users find new ways to generate errors.