Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Allowing just white space in 'Required' data annotation

I am using the [Required] data annotation on a string. This works just as intended, however it deems an input just consisting of white space to be invalid.

Is there any way to change this?

like image 883
Jonathan Avatar asked Nov 30 '11 19:11

Jonathan


1 Answers

There is an AllowEmptyStrings property on the RequiredAttribute. See if that helps.

https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.dataannotations.requiredattribute.allowemptystrings

like image 191
William Avatar answered Sep 18 '22 19:09

William