StringLength validation minimum length not working on client side.

Jul 8, 2009 at 4:17 PM

I have a StringLength ValidationAttribute on one of my properties that has a MinimumLength set on it. This works fine for server side validation, but for client side validation the MinimumLength value never gets set in the javascript. Is anyone else experiencing this problem?

Coordinator
Jul 9, 2009 at 8:59 AM

rmuzzey, the string length rules certainly do work on the client as well as on the server as far as I know. Can you supply any steps to reproduce your problem, or perhaps post a minimal demo project showing a problem? Thanks.

Apr 29, 2010 at 1:23 PM

I have same problem, DataAnnotation + xVal + JQuery

[StringLength(100, MinimumLength = 10)]

[Required]

public virtual String Test { get; set; }

May 25, 2010 at 11:49 PM
Edited May 26, 2010 at 9:46 AM
Galawyn wrote:

I have same problem, DataAnnotation + xVal + JQuery

[StringLength(100, MinimumLength = 10)]

[Required]

public virtual String Test { get; set; }

 I do have this problem but only on IE 8. On Opera 9, Firefox 3.6, Safari 4 and Chrome 4 it works as expected.

Btw, having the default example crashes IE 8 / Win 7 (64 bit), latest patches (OS + browser).

To me it seems the browser is the problem or at most the client-side script(s) (jQuery 1.3.2 and/or the xVal JS file..)

 

It's the BookingsDemo, you know it very well Steve. I just added a [StringLength(5)] on DomainModel.Entities.Booking's Name property.

Jun 9, 2010 at 10:49 PM

I have found / fixed the problem, as described in the following work item.