From 5b2129a124acc0b294e911808b615c2afd596480 Mon Sep 17 00:00:00 2001 From: Ryan O'Neill Date: Tue, 7 May 2024 09:52:34 +0100 Subject: [PATCH] Fix for client side 'required' validator which allowed whitespace to be submitted in input value. This library is now works the same way as jQuery Unobtrusive validation on which it is based. Closes #109 --- src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index d62f17e..2bf0c45 100644 --- a/src/index.ts +++ b/src/index.ts @@ -153,8 +153,9 @@ export class MvcValidationProviders { return false; } - // Default behavior otherwise. - return Boolean(value); + + // Default behavior otherwise (trim ensures whitespace only is not seen as valid). + return Boolean(value?.trim()); } /**