I think it is a great module, that comes with a good userinterface and nice build in features.
But like most things in this world, it is not perfect. The API could use some work, and the Form editor is much to complicated to customize. And then it has some SEO issues, that i do not like.
By Default it uses a 'sitecoresimpleformascx.ascx' usercontrol with some controls on it, to render the form.
This is okay, but the WFFM developer team made some mistakes, if you ask me. They implemented HTML tags in the C# code.
I do not get, why people do this. HTML is frontend, and should be implemented in the Frontend. If you let the C# code implement HTML code there is no easy way to edit it, without having to create your own controls.
Let's take a look at the 'sitecoresimpleformascx.ascx' file.
It can be located at '\sitecore modules\Web\Web Forms for Marketers\Control' and looks like this :
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SitecoreSimpleFormAscx.ascx.cs" Inherits="Sitecore.Form.Web.UI.Controls.SitecoreSimpleFormAscx" %>
<%@ Register Namespace="Sitecore.Form.Web.UI.Controls" Assembly="Sitecore.Forms.Core" TagPrefix="wfm" %>
<wfm:FormTitle ID="title" runat="server"/>
<wfm:FormIntroduction ID="intro" runat="server"/>
<asp:ValidationSummary ID="summary" runat="server" ValidationGroup="submit" CssClass="scfValidationSummary"/>
<wfm:SubmitSummary ID="submitSummary" runat="server" CssClass="scfSubmitSummary"/>
<asp:Panel ID="fieldContainer" runat="server"/>
<wfm:FormFooter ID="footer" runat="server"/>
<wfm:FormSubmit ID="submit" runat="server" Class="scfSubmitButtonBorder"/>
Many of these controls, renders HTML from within the control it self.
Let take a look at the FormTitle control for example.
By using a Reflector tool, we can decompile the control and look at the C# code.
It look like this :
{
using Sitecore.Data.Items;
using Sitecore.Form.Core.Configuration;
using System;
using System.Web.UI;
[ToolboxData("<h1 runat=\"server\"></h1>")]
public class FormTitle : FormText
{
public FormTitle() : this(null)
{
}
public FormTitle(Item item) : base(item, FieldIDs.FormTitleID, HtmlTextWriterTag.H1)
{
}
protected override void OnLoad(EventArgs e)
{
base.Class = "scfTitleBorder";
if ((base.Item != null) && (base.Item.Fields[FieldIDs.ShowFormTitleID].Value == "1"))
{
base.OnLoad(e);
}
}
}
}
As you can see, the constructor forces a <H1> tag to be rendered.
Well, this is a title control, so why is that a problem?
It is, because it is the title of the form, and not the page.
Therefore the title might not be the most important title of the page (http://www.hobo-web.co.uk/headers/)
We might want to use H2, H3 or H4 instead.
Other WFM controls renders <DIV> tags, witch might be okay, but i still believe it is wrong to do it in C#.
So what would be a better solution?
Well, let it be a setting in sitecore!! It should be possible to configure what TAGS to use for the different WFM controls from a settings item inside sitecore. And it should be possible not to have any TAGS at all added to the output.
But that is not the way it is right now. So the only thing we can do for now, is to create our own controls were we want to change something and use these instead.
How would you go about writing a custom control to replace this? I am having this exact issue myself, and while attempting it for several hours I keep running into numerous dead-ends with my code.
SvarSletI appreciate any help possible.
Lasse, du er en dygtig dreng. Nu har jeg googlet i vildskab og faldt over din blog. Jeg sidder og skal ha' lavet om på vores WFFM html på baselinen, da rækkefølgen af elementer er forkert i forhold til standard opsætning. Du kan da helt sikkert hjælpe mig med dette ;)
SvarSletFedt at du blogger om Sitecore.