Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6866429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:10:58+00:00 2026-05-27T03:10:58+00:00

I created an event handler for the item:created event to remove spaces from the

  • 0

I created an event handler for the item:created event to remove spaces from the item name but leave them in the display name which works fine but the problem I’m having is that if I create two items with the same name I want to trigger some validations so that in the content editor the user can see the validation result in the quick action bar.

Before creating my own event, sitecore used to display the broken link icon in the quick action bar but now it doesn’t. How do I invoke validation from code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T03:10:58+00:00Added an answer on May 27, 2026 at 3:10 am

    You should be able to invoke a validator (or validators) in code by using the ValidatorManager object. If you pass in an item representing the validator and an item you are trying to validate you should be able to execute the validator.

    var validatorItem = Sitecore.Data.Database.GetDatabase("master").GetItem("/sitecore/system/Settings/Validation Rules/Item Rules/Item/Duplicate Name");
    var validator = ValidatorManager.BuildValidator(validatorItem, Sitecore.Context.Item);
    
    validator.Validate(new ValidatorOptions(false));
    
    if(!validator.IsValid)
    {
        Response.Write("Error level: " + validator.Result.ToString() + "<br />");
        Response.Write("Error Message: " + validator.Name + "<br />");
    }
    else
    {
        Response.Write("All ok !");
    }
    

    This example shows a single validator but the manager supports collections of validators too, just dig around the object a bit 🙂

    If you are creating your own validator you can look here for a tutorial make sure you are inheriting from StandardValidator

    Hopefully a better answer 😛

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have simple SSIS package in which On Error event handler I have created
We have repositories which have a Save method. They also throw a Created event
I've created a python script in which an event needs to be executed each
I've created some dynamic controls on page load and added an event handler to
To create a new event handler on a control you can do this c.Click
How do I create a C# event handler that can be handled in IronPython?
In my Silverlight app I have an event handler that dynamically creates a new
I have a global event created and set/reset in a native C++ process that
I have an application that has created a number of custom event log sources
I am currently making a context menu which open from left button click instead

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.