Try our conversational search powered by Generative AI!

How to add a custom XForm DataType?

I understand that it is possible to create custom DataTypes with custom validation rules in XForms. But the documentation is very sparse. From the Xform technote I gather that I must do something with the EPiServer.XForms.DataTypes class. But I cannot work out what i must do. Can someone please help me? I want to add a custom datatype called "Customer number". The customer number should always have 11 digits. After I have added this new datatype I want to see "Customer number" as an option in the Validation dropdown when using the XForm editor. And when a user submits a form with a customer number of only 10 digits I want the user to be notified of his/her error as the standard datatype validators do. Regards, Jacob Hamacher
Jan 24, 2007 14:12
I solved the problem myself. Actually I did the right thing from the start, the only issue was lack of compiling. My problem is that I do not have access to Developer Studio at my clients office. I use another texteditor. Most of the time ASP.NET2.0 does the right thing anyway compiling when I make changes to the sourcecode. Especially if I change "codebehind" to "codefile". But apparently changes to global.aspx.cs have to be compiled into the main dll. I downloaded the sourcecode to the office, compiled everything into a dll and uploaded the dll to the webserver. Now it works and the custom validation rule appears in the XForms editor. If anoyone else has the same question. Make sure you add this to the Application_Start in global.aspx.cs. EPiServer.XForms.DataTypes.Types.Add("Testinteger", @"^(-)?\d+$"); /jacob
Jan 26, 2007 14:25
That's great, I didn't know you could add your own validators! You learn something new every day.
Jan 28, 2007 22:58
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.