Reading properties of a filled out form via IFormEntryCreate

Posted by Community Admin on 04-Aug-2018 22:14

Reading properties of a filled out form via IFormEntryCreatedEvent

All Replies

Posted by Community Admin on 26-May-2015 00:00

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.

Posted by Community Admin on 29-May-2015 00:00

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

 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 17-May-2016 00:00

Hi

I have the exact same question, can you please share the provided solution?

/Keivan

Posted by Community Admin on 19-May-2016 00:00

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);
           
       

In addition to this, you may also check the below KB article for more details about getting form field values from form responses:

http://docs.sitefinity.com/for-developers-get-formfield-values-from-submitted-form-responses

Regards,
Sabrie Nedzhip
Telerik
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

This thread is closed