For anyone that has or is going to install Sitecore’s Web Forms for Marketers module, the module comes with it’s own patch config file as you can expect. Depending on the version of Sitecore you are using, it’s either called forms.config or Sitecore.Forms.config. One of the post-install steps of the package is to configure a data provider with a database connection, e.g.
<formsDataProvider
. The default configuration of this SQL-based provider is to define a connection string as the first string-based parameter below the provider, e.g.
type="Sitecore.Forms.Data.DataProviders.WFMDataProvider,Sitecore.Forms.Core">
[sourcecode]
<formsDataProvider type="Sitecore.Forms.Data.DataProviders.WFMDataProvider,Sitecore.Forms.Core">
<param desc="connection string">Database=(database);Data Source=(server);user id=(user);password=(password);Connect Timeout=30</param>
</formsDataProvider>
[/sourcecode]
This connection string is deeply embedded within this patch config and does not follow the standard connection string configuration in the ConnectionStrings.config
file. Luckily, you can swap this out for a normal token-based connection string in ConnectionStrings.config
.
If you de-compile the data provider and look at its constructor, you can see that when no string parameter is provided, it falls back to WebFormsContext.ConnectionString
:
That base connection string property looks for a standard connection string with a token of "wfm"
:
So the simple way to follow the standard approach to defining the database in ConnectionStrings.config
is to define a string with that "wfm"
token and ensure there is no parameter to the data provider:
[sourcecode]
<add name="wfm" connectionString="user id=username;password=password;Data Source=(server);Database=(database)" />
[/sourcecode]
[sourcecode]
<formsDataProvider type="Sitecore.Forms.Data.DataProviders.WFMDataProvider,Sitecore.Forms.Core">
</formsDataProvider>
[/sourcecode]
Leave a comment if you have any other tips like this.
Hi Mark,
thanks for the blog,
I followed the steps but I am having the error:
”
Could not load type ‘Sitecore.Form.Submit.ISaveAction’ from assembly ‘Sitecore.Forms.Core, Version=8.1.0.0, Culture=neutral, PublicKeyToken=null’.
“