Unobtrusive Clientside Validation

Topics: Customizing Orchard, General, Writing modules
Jul 23, 2012 at 7:48 PM

Does the latest version of Orchard (currently 1.5) support unobtrusive client side validation as provided by MVC and jquery.validate.js?

Coordinator
Jul 23, 2012 at 8:03 PM

No.

Jul 23, 2012 at 10:50 PM

Vote here

http://orchard.codeplex.com/workitem/18269

and check dirty hack inside discussion

Jul 23, 2012 at 11:07 PM

@rodpl: Thanks I saw this before and tried to do it, but must be missing something. Where do you actually add the following code (as given in that post) to:

    public class ContainerModule : Module
    {
        protected override void Load(ContainerBuilder builder)
        {
            base.Load(builder);

            ModelValidatorProviders.Providers.Clear();
            ModelValidatorProviders.Providers.Add(new DataAnnotationsModelValidatorProvider());
            ModelValidatorProviders.Providers.Add(new DataErrorInfoModelValidatorProvider());
            ModelValidatorProviders.Providers.Add(new ClientDataTypeModelValidatorProvider());
        }
    }

And are you supposed to add new references to the project? Because I cant fin where Module is defined.

Jul 24, 2012 at 12:57 PM

Yes. You must reference AutoFac.dll library which is used by Orchard itself.

Jul 24, 2012 at 1:19 PM

And where do I place the above code?

Jul 24, 2012 at 1:35 PM
Edited Jul 24, 2012 at 1:35 PM

As class, anywhere in your own orchard module

Jul 24, 2012 at 2:00 PM

Thanks, I will try this.