sashaeve
sashaeve

Reputation: 9617

How to enable a client validation (Orchard CMS)?

I am trying to add client validation for user registration page in Orchard CMS.

Server-side validation is implemented as following (working well):

if (String.IsNullOrEmpty(userName)) {
    ModelState.AddModelError("username", T("You must specify a username."));
    validate = false;
}

if (String.IsNullOrEmpty(email)) {
    ModelState.AddModelError("email", T("You must specify an email address."));
    validate = false;
}

I've added all jQuery related scripts to the view, enabled client validation in web.config:

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

Also I added DataAnnotations to the UserPart class properties and UserCreateViewModel class properties.

No luck.

So the questions are:

  1. Does Orchard CMS support MVC 3.0 client validation with DataAnnotations?
  2. What I should do to make validation working?

Upvotes: 2

Views: 1407

Answers (1)

DanielEli
DanielEli

Reputation: 3503

I think you have to implement them yourself according to a brief scan of this thread. http://orchard.codeplex.com/discussions/243523

Upvotes: 1

Related Questions