catch Sitecore Event

pas de web.config als volgt aan:

      <event name="item:saving">
        <handlertype="CatchSave.Class1, CatchSave"method="OnItemSaved"/>
      </event>  

Daar hoort dan de bijbehorende class en method bij:

using System;
using System.Collections.Generic;
using System.Text;
using Sitecore.Data.Items;
using Sitecore.Events;
namespace CatchSave
{
   public class Class1
   {
      protected void OnItemSaved(object obj, EventArgs args)
      {
         Item item1 = Event.ExtractParameter(args, 0) as Item;
         SitecoreEventArgs evt = args as SitecoreEventArgs;

         // here we can check if the title field filters out unsuitable Items

         if (item1.Fields["Title"].Value=="wrong text")
         {
            evt.Result.Cancel=true;
            Sitecore.Context.ClientPage.ClientResponse.Eval("alert('You are not right!')");

         }
      }
   }
}

{{opmerking.Naam}}:

{{opmerking.OpmerkingText}}

            

Saving your comment....

Naam is verplicht!
Email is verplicht!
Opmerking is verplicht!