If I add a MaxLengthAttribute
to a property like this:
[MaxLength]
[DataType(DataType.MultilineText)]
public string Notes { get; set; }
The markup is rendered like this:
<textarea class="form-control" data-bind="value: Notes" data-val="true" data-val-maxlength="The field Notes must be a string or array type with a maximum length of '-1'." data-val-maxlength-max="-1" id="Notes" name="Notes"></textarea>
and the validation result looks something like this:
This is obviously not the intended result. The text area should allow A LOT more characters than '-1'.
I can think of multiple ways of addressing this (e.g. removing the attribute via jQuery, manually updating the rule with javascript, etc).
What is the most elegant way of addressing this issue? Is this a bug with MVC/Validator