Nov 2, 2010
  5015
(1 votes)

XForm reserved names for input fields

There's a bug in the XForm implementation that "allow" users to add a input field with the name "id". I put allow in quotes because in CMS 6, the XForm edit dialog will crash and not let you save the XForm. But in CMS 5+ it actually lets you save it and it will later crash when you're trying to get the form data out. Mohahaha-haha... This is especially evil when migrating over from CMS 4, as there was no problem having a field called id there, so you could have a whole bunch of these just waiting to explode after you migrated.

This behavior is because id is a reserved keyword for XForms. So it's important to tell this to your editors.   

And it doesn't stop there. if you import a form from CMS 4 into CMS 6 and get this error, the normal thing would be to delete it and start anew, but oh no. That would be to easy right? Because you can't delete it in XForm editor. Actually you can't do anything because it will crash as soon as it tries to read the XForm's xml definition.

Database to the rescue!

By now you might have started to sweat. But take it easy, you can remove it, but you will have to do it directly in the database. First thing you want to do is to find the offending XForm in the tblSystemBigTable (or the more convenient way of using a view: dbo.VW_XForms). The column FormName hold the XForm's name so you can locate it that way (or using Windmill Explorer). The row also contain the GUID for the XForm. Use this GUID to remove the XForm from the tables it is referenced in by using it as the input for the stored procedure dbo.BigTableDeleteItem. This should take care of it and you should not see it in the XForm browser anymore or in a property.

CMS 5 R2 SP2

"What about me" you say? Well for you it's easier or harder depending on what you want to do.

If you want to delete the XForm and go on with your life, than it's easier, as you can do it as you normally would via the XForm editor. But if you want to extract the data, it's harder.

"Uh yeah that's great, but what about all the data. Can we get that back?!"

Yes! In CMS 6 it's a bit easier because the data isn't serialized, i.e it is in plain text. And every XForm automatically gets its own database view that will show you the submitted data, so use those. If you don't want to use the database you can always write something that takes the values and writes them to a csv file or something similar. And this is exactly what I've done, but for the CMS 5 R2 SP2 version. This because the CMS 5 versions doesn't have any views and the data is serialized, so it's much harder to extract it directly via a SQL script.

The "tool"

This tool is for CMS 5 R2 SP2 and it's not tested at all (well it runs!). The idea is to give you the basic code skeleton and you can then modify it to your needs. So if you are going to use it you should first go through and understand the code and then do the necessary changes. But hopefully it is easy to understand and if you do some improvements you are welcome to post them here for others to enjoy (pleaase do some refactoring, pretty pleeeaase ;).

XFormExport.zip

Installation: Include the files to your project and compile.

Instructions: Input the XForm's GUID (use Windmill explorer to find it) for which you want to export the form data from. The tool then goes through all the form data postings and writes them to a file in c:\temp\xform, so make sure the IIS account has write/read access to it.

 


The error you receive when trying to save the XForm or export data from it:

Property Id must be of type System.Guid or EPiServer.Data.Identity

Nov 02, 2010

Comments

smithsson68@gmail.com
smithsson68@gmail.com Nov 2, 2010 09:50 AM

Hi Tobias.

Great information!

Paul.

Nov 2, 2010 10:00 AM

And yes there is a bug report about it and it has been fixed for the next release of CMS 6 :)

Bug #57900: Editors are allowed to save XForms with input fields named "id"

Huy Le
Huy Le Nov 3, 2010 09:46 AM

It's great Tobi ;)

Please login to comment.
Latest blogs
Resource Editor - A localization management tool for Optimizely CMS

If you have worked with Optimizely CMS for any amount of time you know that managing localization through XML files can be tedious. Content type...

Per Nergård (MVP) | Feb 23, 2026

Storing JSON in a property the efficient way

Here is a little-known trick to store and retrieve JSON property data more efficiently.

Stefan Holm Olsen | Feb 23, 2026 |

Upgrade RSS Feed Integration to Optimizely CMS 13 – v3.0.0 Beta

I’ve upgraded my  RSS Feed Integration library for Optimizely CMS to support Optimizely CMS 13. Version 3.0.0 is currently released as a beta to...

David Drouin-Prince | Feb 21, 2026 |

Multi Site NuGet v2 for Optimizely CMS 13 – Breaking Changes & Migration

The beta version 2 of DavidHome.Optimizely.MultiSite is now available on NuGet: https://www.nuget.org/packages?q=DavidHome.Optimizely.MultiSite Thi...

David Drouin-Prince | Feb 21, 2026 |

Automate Your OCP Opal Tool Development with PowerShell

Creating an OCP (Optimizely Connect Platform) Opal Tool app from scratch can be time consuming and error prone. You need to set up the project...

Sanjay Kumar | Feb 21, 2026

Using HeadlessKit to build a head for an Optimizely SaaS CMS in .NET 10

Headless has a tendency to promise freedom and deliver alignment meetings. Two codebases. Two sets of models. Two teams trying very hard not to dri...

Allan Thraen | Feb 19, 2026 |