November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
found the solution, need to install at least .net 4.5.2 framework. didn't see this solution anywhere else or as a system requirment when installing episerver forms... :(
Hi,
Here is a code I copied to override Form Submiting. However when I compile my project, I get a "Error112The type or namespace name 'Forms' does not exist in the namespace 'EPiServer' (are you missing an assembly reference?)
I have installed Episerver Forms by nuget, and I checked my References and Episerver.Forms, Episerver.Forms.Core and Episerver.Forms.UI are all there.
using System;
using System.Linq;
using EPiServer.Framework;
using EPiServer.Framework.Initialization;
using EPiServer.ServiceLocation;
using EPiServer.Forms.Core.Events;
using EPiServer.Logging;
using EPiServer.Core;
using EPiServer.Forms.Core.Models;
using EPiServer;
using EPiServer.Forms.Core;
namespace AlloyDemoKit.Business.Forms
{
[InitializableModule]
[ModuleDependency(typeof(EPiServer.Web.InitializationModule))]
public class FormEventsInitialization : IInitializableModule
{
private static readonly ILogger _logger = LogManager.GetLogger();
public void Initialize(InitializationEngine context)();
{
var formsEvents = ServiceLocator.Current.GetInstance
formsEvents.FormsSubmissionFinalized += FormsEvents_FormsSubmissionFinalized;
}
private void FormsEvents_FormsSubmissionFinalized(object sender, FormsEventArgs e)();
{
if (!string.IsNullOrEmpty(e.FormsContent.Name))
{
var loader = ServiceLocator.Current.GetInstance
FormsSubmittedEventArgs submitArgs = e as FormsSubmittedEventArgs;
string msg = string.Format("Form {0} completed at {1}\tSubmission id: {2}",
e.FormsContent.Name,
DateTime.Now,
submitArgs.SubmissionData.Id);
_logger.Information(msg);
var formElements = submitArgs.FormsContent.Property["ElementsArea"].Value as ContentArea;
foreach (var item in submitArgs.SubmissionData.Data)(elementId.ContentLink) as ElementBlockBase;
{
if (item.Key.StartsWith("SYSTEM"))
{
_logger.Information(item.Key + ": " + item.Value);
}
else
{
int id = Convert.ToInt32(item.Key.Substring(item.Key.LastIndexOf("_") + 1));
var elementId = formElements.Items.Where(i => i.ContentLink.ID == id).FirstOrDefault();
ElementBlockBase element = loader.Get
string friendlyName = element != null ? element.GetElementInfo().FriendlyName : item.Key;
_logger.Information(friendlyName + ": " + item.Value);
}
}
}
}
public void Preload(string[] parameters) { }
public void Uninitialize(InitializationEngine context)();
{
var formsEvents = ServiceLocator.Current.GetInstance
formsEvents.FormsSubmissionFinalized -= FormsEvents_FormsSubmissionFinalized; ;
}
}
}