Bug: Sitecore 8 with Web Forms For Marketers – Drop List Entries Not Being Properly Recorded in xDB
Sitecore 8 is the new cool nowadays! The hype is indeed well deserved. Recently I had a chance to explore some of the modules and prototype a good amount of functionality in Sitecore 8, which has uncovered a bug with Web Forms for Marketers manually entered dropdown lists. This article describes the issue and provides a patch, so read on.
Web Forms for Marketers (WFFM) is one of my favorite Sitecore modules. It was the first one I installed while evaluating Sitecore and it stayed with me proving to be useful in almost every Sitecore website I built. Marketers love having control over forms on the website and developers enjoy not being bothered by silly form update requests – it’s a win-win!
Web Forms for Marketers Dropdown List Value is not Being Saved Properly
Sitecore 8 came with an overhaul of the User Interface and a whole basket of new goodies and changed functionality, one of which is a new Web Forms for Marketers Module. We now have two packages – one for the Content Management (CM) environment and one for Content Delivery (CD). Recently I was demoing Sitecore 8 MVC site implementation for one of the clients and one feature they were particularly interested in investigating was the WFFM module.
We have setup a clean instance of Sitecore 8 rev 150223 using an executable. Then we installed the WFFM CM package.
Note: if you run into an issue with the WFFM installation taking a long time, it may be due to the xDB not being setup (Mongo). Check the logs and if they contain errors related to Mongo, make sure the xDB has been properly configured and the Mongo database is up and accessible (check out MongoVUE).
While demoing the WFFM functionality we created a test form with a list of most popular controls, including a Drop List. We then added some manual options and added a Send Email Message submit action configured to email the values entered in the form fields to one of the developers’ emails.
Before we move on, remember that when using an Email Action in WFFM, remember that besides configuring the MailServer settings in Sitecore configuration, they must also be configured on the action definition item /sitecore/system/Modules/Web Forms for Marketers/Settings/Actions/Save Actions/Send Email Message in the Parameters field.
Tip: the parameters field accepts a not very widely known parameter enableSSL, which allows using a Gmail account for testing purposes. Example:
<Host>smtp.gmail.com</Host> <From>firstname.lastname@example.org</From> <IsBodyHtml>true</IsBodyHtml> <enableSSL>true</enableSSL>
Once we had it all setup and configured, we submitted the first form, and noticed that all field tokens in the Send Email Message action were replaced by correct values, except for the one from the Drop List, which was empty. After looking in Mongo DB, we noticed that the Value property for the Drop List field was not being properly populated, instead of the value entered on the form, the C# fully qualified type name for generic list was being saved instead (System.Collections.Generic.List). This started looking like a support ticket to Sitecore.
How to Fix Drop List Issue with Blank Values in Sitecore 8 Web Forms for Marketers MVC
After submitting a support ticket for the WFFM Drop List issue the Sitecore team was prompt to reply with a confirmation of a bug and a fix. Simply follow these steps to fix the bug –
- Doownload and extract the Sitecore.Support.424929 assembly into the bin folder
- Modify \Website\Views\Form\EditorTemplates\DropListField.cshtml file
- Navigate to the /sitecore/system/Modules/Web Forms for Marketers/Settings/Field Types/List Types/Drop List item and set its MVC Type field value to Sitecore.Support.Forms.Mvc.Models.Fields.DropListField,Sitecore.Support.424929
- Publish the change.
I would suggest everyone who is using this module to implement this bug fix no matter whether this functionality is currently being used or not. Marketers are creatures driven by unknown to us forces, thus, you never know when they will decide to use a Drop List with manually entered values. As good Sitecore developers and administrators we want to always be a few steps ahead, right? So, if you are running Sitecore 8 with Web Forms for Marketers, go ahead and drop in this fix, and enjoy another job well done!