Add validation to XForms textbox
I recently came across a partner that needed to add custom validation in the Editor making it possible to validate for such things as emails ending with .dk are not allowed.
After some failure in digging around I went to the back-end team and asked Paul Smith and Per Gunsarfs who had the answer I was looking for.
Here some code to add your own little XForms validation:
1: using System;
2: using System.Collections.Generic;
3: using System.Linq;
4: using System.Web;
5:
6: namespace EPiServer
7: {
8: public class XformsStuff : EPiServer.PlugIn.PlugInAttribute
9: {
10: public static void Start()
11: {
12: EPiServer.XForms.DataTypes.Types.Add("specialemail", "my awesome regexp");
13:
14: }
15: }
16: }
Here is what it looks live in the XForms editor

28 July 2009