WFFM End of string expected at position 61


You have placed a form built using the WebForms for Marketers module on your page and are getting this error:

End of string expected at position 61.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Sitecore.Data.Query.ParseException: End of string expected at position 61.

And your stack trace contains the following:

[ParseException: End of string expected at position 61.]
   Sitecore.Data.Query.QueryParser.Raise(String error) +209
   Sitecore.Data.Query.QueryParser.DoParse(String query) +227
   Sitecore.Data.Query.Query..ctor(String query) +80
   Sitecore.Data.Query.Query.SelectItems(String query, QueryContext contextNode, Database database) +119
   Sitecore.Form.Core.Ascx.Controls.SimpleForm.HasVisibleFields(ID formId) +177


It’s because you have a hyphen in the Form item name.  The last line in the stack trace snippet above is a call to the Sitecore.Form.Core.Ascx.Controls.SimpleForm.HasVisibleFields(ID formId) method.  If you decompile the Sitecore.Forms.Core.dll and go to the method above, you will find these two lines:

string query = string.Format("{0}//*[@@templateid = '{1}']", item.Paths.FullPath, IDs.FieldTemplateID);
Item[] array = item.Axes.SelectItems(query);

item.Paths.FullPath refers to the path to the WebFrom item under System, example, /sitecore/system/Modules/Web Forms for Marketers/Website/wffm example1.  So the first line I mentioned above builds a Sitecore query.  The second line executes the query.  That’s where a hyphen would break everything for you because words that contain hyphens need to be wrapped in a hash or pound symbol (#).


Remove the hyphen from your form item name and this error should go away.

Leave a Reply