5.3.1: Validation Pipeline Component – Update

In this comment, Sander – of eFocus, a dutch Sitecore partner – is pointing me on a bug in my pipeline processor. I’ve to confirm his bug. It could be resolved by adding the following line after the retrieving of the original item and around the start and reject edit:

                //Retrieve the last saved version of the item

                Item orgItem = Context.ContentDatabase.Items[saveItem.ID, saveItem.Language, saveItem.Version];


                if (orgItem.Paths.IsContentItem)


                    //Start editing the item and overwrite the field with the saved ones






                    //Reject the changes, savind will be done in a later stage of the pipeline



6 thoughts on “5.3.1: Validation Pipeline Component – Update”

  1. Next stop: adding a ‘fix it’ option when validation fails, for instance: trim a field to the maximum allowed number of characters. I’ve extended your processor and the default ValidationResult and used the code from one of your previous posts (http://sitecore.alexiasoft.nl/2006/10/05/hacking-the-core-locking-items-for-editing-part-1/) to show a confirmation box. The box is displayed and when clicking ‘yes’ … well, nothing much really happens 🙂 I’m still trying to figure out how to stitch it all together so that a ‘fixit’ function is invoked for all fields on which validation failed (if a ‘fixit’ function exists for that validator). If you’re interested in the code, drop me an e-mail.

  2. Ouch, I just discoverd an other error:

    When navigation away from a page (clicking on another page or item in the content tree) with unsaved invalid fields you first get a confirmation box “Do you want to save changes to the item” and click “yes” to get the Invalid fields alert. Instead of staying on the page, SiteCore moves to the clicked item and (by design) the previous item doesn’t get saved.

    Any changes to the previous item are lost and there is no way to retrieve them. I can imagine clients moping over this one 🙂 I assume that the ‘move to the next page’ functionality is also somewhere in the pipeline and can be canceled as well?

  3. This is an interesting article – I’m currently struggling with Sitecore’s inability to validate fields and set default values (pretty basic requirements really). Did anyone find a resolution to the problems mentioned ?

Comments are closed.