<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>JQuery &#8211; blog.boro2g .co.uk</title>
	<atom:link href="https://blog.boro2g.co.uk/category/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.boro2g.co.uk</link>
	<description>Some ideas about coding, dev and all things online.</description>
	<lastBuildDate>Wed, 19 Nov 2014 15:21:11 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.5.8</generator>
	<item>
		<title>Two submit buttons in Sitecore WFFM</title>
		<link>https://blog.boro2g.co.uk/two-submit-buttons-sitecore-wffm/</link>
					<comments>https://blog.boro2g.co.uk/two-submit-buttons-sitecore-wffm/#respond</comments>
		
		<dc:creator><![CDATA[boro]]></dc:creator>
		<pubDate>Wed, 19 Nov 2014 14:44:48 +0000</pubDate>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Sitecore]]></category>
		<guid isPermaLink="false">http://blog.boro2g.co.uk/?p=484</guid>

					<description><![CDATA[<p>We recently ran into an interesting challenge where the user wanted two submit buttons on their wffm form, the value of which then needed logging in the WFFM database. Note this approach does rely on javascript. WFFM gives you the ability to setup custom fields (see Sitecore docs). I based this implementation on section 3.7.3 In [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://blog.boro2g.co.uk/two-submit-buttons-sitecore-wffm/">Two submit buttons in Sitecore WFFM</a> appeared first on <a rel="nofollow" href="https://blog.boro2g.co.uk">blog.boro2g .co.uk</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>We recently ran into an interesting challenge where the user wanted two submit buttons on their wffm form, the value of which then needed logging in the WFFM database. Note this approach does rely on javascript.</p>
<p>WFFM gives you the ability to setup custom fields (see <a href="http://sdn.sitecore.net/upload/sdn5/products/web_forms2/web%20forms%20for%20marketers%20v2_3%20reference-usletter.pdf">Sitecore docs</a>). I based this implementation on section 3.7.3</p>
<p>In your solution setup a custom ascx:</p><pre class="crayon-plain-tag">&lt;%@ Control Language=&quot;C#&quot; AutoEventWireup=&quot;true&quot; CodeBehind=&quot;CustomFormItem.ascx.cs&quot; Inherits=&quot;###.Website.Forms.CustomFormItem&quot; %&gt;
&lt;asp:HiddenField runat=&quot;server&quot; ID=&quot;ButtonHiddenField&quot; /&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
    $scw(document).ready(function () {
        var hiddenField = $scw('#&lt;%= ButtonHiddenField.ClientID%&gt;')
        var submit = hiddenField.parentsUntil('#MainPanel').find(':submit');
        var clone = submit.clone(true);
        clone.attr('value', '&lt;%=Title%&gt;');
        clone.click(function() {
            hiddenField.val('&lt;%=Title%&gt;');
        });
        submit.click(function() {
            hiddenField.val('&lt;%=DefaultButtonText%&gt;');
        });
        clone.appendTo(submit.parent());
    });
&lt;/script&gt;</pre><p>and then the code behind:</p><pre class="crayon-plain-tag">using System;
using System.Web.UI;
using Sitecore.Data.Items;
using Sitecore.Form.Core.Controls.Data;
using Sitecore.Form.Web.UI.Controls;

namespace ###.Website.Forms
{
    public partial class CustomFormItem : ValidateUserControl, IHasTitle
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public string DefaultButtonText
        {
            get 
            { 
                Item item = Sitecore.Context.Database.GetItem(Form.FormID);

                if (item != null)
                {
                    return item.Fields[&quot;Name&quot;].Value;
                }

                return &quot;default button&quot;;
            }
        }

        public override ControlResult Result
        {
            get { return new ControlResult(&quot;Custom Button&quot;, ButtonHiddenField.Value, &quot;parameters&quot;); }
        }

        protected override Control ValidatorContainer
        {
            get { return new Control(); }
        }

        protected override Control InnerValidatorContainer
        {
            get { return new Control(); }
        }

        public string Title { get; set; }
    }
}</pre><p></p>
<p>You then need to create the custom field within Sitecore. This wants to live in &#8216;/sitecore/system/Modules/Web Forms for Marketers/Settings/Field Types/Custom&#8217;. The only field you need to set is the UserControl field. In my example this was <strong>/forms/customformitem.ascx</strong>.</p>
<p>When you setup your form you can then select:<br />
<a href="http://blog.boro2g.co.uk/wp-content/uploads/2014/11/select-the-type.png"><img fetchpriority="high" decoding="async" src="http://blog.boro2g.co.uk/wp-content/uploads/2014/11/select-the-type.png" alt="select the type" width="509" height="260" class="alignnone size-full wp-image-487" srcset="https://blog.boro2g.co.uk/wp-content/uploads/2014/11/select-the-type.png 509w, https://blog.boro2g.co.uk/wp-content/uploads/2014/11/select-the-type-300x153.png 300w" sizes="(max-width: 509px) 100vw, 509px" /></a></p>
<p>In the front end this looks like:<br />
<a href="http://blog.boro2g.co.uk/wp-content/uploads/2014/11/form.png"><img decoding="async" src="http://blog.boro2g.co.uk/wp-content/uploads/2014/11/form.png" alt="form" width="574" height="99" class="alignnone size-full wp-image-485" srcset="https://blog.boro2g.co.uk/wp-content/uploads/2014/11/form.png 574w, https://blog.boro2g.co.uk/wp-content/uploads/2014/11/form-300x51.png 300w" sizes="(max-width: 574px) 100vw, 574px" /></a></p>
<p>And finally, when you submit you get:<br />
<a href="http://blog.boro2g.co.uk/wp-content/uploads/2014/11/report.png"><img decoding="async" src="http://blog.boro2g.co.uk/wp-content/uploads/2014/11/report.png" alt="report" width="787" height="122" class="alignnone size-full wp-image-486" srcset="https://blog.boro2g.co.uk/wp-content/uploads/2014/11/report.png 787w, https://blog.boro2g.co.uk/wp-content/uploads/2014/11/report-300x46.png 300w" sizes="(max-width: 787px) 100vw, 787px" /></a></p>
<p>Sorry mr a&#64;&#98;&#x2e;&#x63;om!, you might receive a few test signups 🙂</p>
<p>The post <a rel="nofollow" href="https://blog.boro2g.co.uk/two-submit-buttons-sitecore-wffm/">Two submit buttons in Sitecore WFFM</a> appeared first on <a rel="nofollow" href="https://blog.boro2g.co.uk">blog.boro2g .co.uk</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.boro2g.co.uk/two-submit-buttons-sitecore-wffm/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
