Reading properties of a filled out form via IFormEntryCreatedEvent
Hi,
I've inherited from FormsControl and have created custom properties on the object. The form has been deployed to a page.
I am looking to configure my subclass of FormsControl to have some data about how to process the form data.
I am subscribing to the IFormEntryCreatedEvent event and would like to read properties that were set on the form when it was dropped on a page.
I can't seem to find a way to get at the properties of the widget that the submission came from.
Perhaps there is a better way to do this?
I am looking to send an email to an email address that is provided in a field of the form. I created properties on the FormsControl which are set via the content editor for the FormsControl I created. One of the properties is the name of the field of the form that contains the email address.
I can trap the event and tell which form the entry came from, however I have no context of the instance of the FormsControl.
Hi Elan,
I have provided an answer in the support ticket that you have recently opened. Please check it for more details.
Regards,
Kaloyan
Telerik
Hi
I have the exact same question, can you please share the provided solution?
/Keivan
Hello Keivan,
I am pasting the reply provided in the support ticket:
Such kind of implementation will not be very simple and might require a lot of customizations. What you can try is to gather the desired information by using the form events from the EventHub:
AJAX forms events: http://docs.sitefinity.com/for-developers-ajax-forms-events
Here is a short sample:
protected void Application_Start(object sender, EventArgs e) Bootstrapper.Initialized += new EventHandler<Telerik.Sitefinity.Data.ExecutedEventArgs>(this.Bootstrapper_Initialized); private void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs e) if (e.CommandName == "RegisterRoutes") EventHub.Subscribe<FormSavedEvent>(evt => FormEventHandler(evt)); protected virtual void FormEventHandler(FormSavedEvent evt) var formTitle = evt.FormTitle; var controls = evt.Controls; Dictionary<string, string> values = new Dictionary<string, string>(); foreach (var control in controls) var value = control.Value != null ? control.Value.ToString() : null; var fieldName = control.FieldName; values.Add(fieldName, value);