Sergey
Sergey

Reputation: 8071

MVC unobtrusive doesn't work?

I've set jquery.unobtrusive-ajax.js and jquery.js file and in web.config I've set

<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />

But it still refreshes the page instead of doing javascript validation.

Also my model has:

[Required(ErrorMessage = "Reguired")]
public string UserName { get; set; }

[Required(ErrorMessage = "Reguired")]
public string Password { get; set; }

Please help

Upvotes: 1

Views: 887

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038770

You need to add jquery.validate.js and jquery.validate.unobtrusive.js in that order. jquery.unobtrusive-ajax.js is to make Ajax.* helpers work, it has nothing to do with validation.

Upvotes: 4

Related Questions