Skip to content

Commit 5b2129a

Browse files
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
1 parent fd1e5a6 commit 5b2129a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,9 @@ export class MvcValidationProviders {
153153

154154
return false;
155155
}
156-
// Default behavior otherwise.
157-
return Boolean(value);
156+
157+
// Default behavior otherwise (trim ensures whitespace only is not seen as valid).
158+
return Boolean(value?.trim());
158159
}
159160

160161
/**

0 commit comments

Comments
 (0)