2
votes

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?
1

1 Answers

1
votes

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