It's not possible without some custom code. The simplest is to create a custom hidden field and store the page URL in this, which will then get submitted along with the other values of the form. You can then use this in your own save actions or the Send Email save action as part of the message body in much the same way as any other form value.
I have previously blogged about a custom Hidden Token Field in WFFM which does exactly this. The code can be shortened if you only want the URL.
Create the field and add properties to allow the
public class HiddenUrl : InputControl
{
protected HiddenUrl() {}
protected HiddenUrl(HtmlTextWriterTag tag) : base(tag) {}
// Override to hide fields in Form Editor
public new string CssClass { get; set; }
public new string Information { get; set; }
public new string Text { get; set; }
// If we were using ASP.Net WebForms then we'd need to expand this
public virtual string Value { get; set; }
}
Create a model to be used for your MVC view:
public class HiddenUrlField : FieldViewModel, IFieldResult, IContainerMetadata
{
public string ResultParameters { get; set; }
[DefaultValue("")]
public virtual string Value { get; set; }
public virtual ControlResult GetResult()
{
return new ControlResult(this.FieldItemId, this.Name, (object)this.Value, this.ResultParameters, false);
}
public override void Initialize()
{
base.Initialize();
var options = UrlOptions.DefaultOptions;
options.AlwaysIncludeServerUrl = true;
Value = LinkManager.GetItemUrl(Sitecore.Context.Item, options);
}
}
And create the view for this field;
@model MyProject.CMS.Custom.WFFM.Fields.HiddenUrlField
@Html.HiddenFor(x => Model.FieldItemId)
@Html.HiddenFor(x => Model.Value)
We need to add this field to WFFM, create an item in Sitecore under /sitecore/system/Modules/Web Forms for Marketers/Settings/Field Types
. For example:
- Item Path:
/sitecore/system/Modules/Web Forms for Marketers/Settings/Field Types/Custom/HiddenUrlField
- Template:
/sitecore/templates/Web Forms for Marketers/Field Type
- Assembly:
MyProject.CMS.Custom
- Class:
MyProject.CMS.Custom.WFFM.Fields.HiddenUrl
- MVC Type:
MyProject.CMS.Custom.WFFM.Fields.HuddenUrlField, MyProject.CMS.Custom