More in this section
Blogs RSS feed

PerForm Better: How to Process the Sitefinity Forms Responses

by User Not Found

Following up on one of the Rado’s posts about implementing notifications for incoming Forms responses, I wanted to cover how to further customize the Forms widget to actually process the individual responses.

Some people would have many specific project requirements. Those include many scenarios and integrations with external systems. In order to achieve those, the developers have to know how to interact with Sitefinity to conForm to the requirements they have. As far as the Sitefinity Forms are concerned there can be many alternative possibilities for integration, but for most of them there is one essential step that needs to be done. This step can be expressed with a simple user case:

As a developer, I would like to be able to process the form responses upon their submission and do whatever I have to do with them…”

Sounds, pretty straightforward, doesn’t it? But before we continue with the ways to do that, lets dive a little deeper into the possible implications of this user case.

What to do with all this inFormation?

The simple widget that I built in this post is aware of the forms responses and you can use it as a base to further process the responses and implement any custom scenario that would involve them.

For instance, you can get any submitted responses and send them to another form to prepopulate its fields or you can even send a specially prepared e-mail that can be imported into a CRM or any other application. This can also come quite handy, if you need to store the responses in another database or just wanted to have a more comprehensive e-mail notification for the Sitefinity admins.

In any way, interacting with the each of the forms responses is very essential and Sitefinity offers an easy way to do so. Now it's showtime!

Let’s Formulate the code then

Probably, this is the most important task that this article has to accomplish. The easiest way to achieve that functionality will be to extend the existing forms widget and provide our additional logic there. So what we really want here is to use the very same Sitefinity forms widget, but with the small difference that when you click the submit button, the code will access the form response and implement any kind of custom logic the business may require.

So in this case, step one will be to create a class that inherits from the default form widget used in Sitefinity. And by inheriting from the main widget class, we will also inherit the designer, the logic, the properties and everything. And here it is:

public class ExtendedForms : Telerik.Sitefinity.Modules.Forms.Web.UI.FormsControl

Step two is to extend the desirable method. In this case, I have chosen to jump into the Submit_Click event handler. So, all I have to do is to override the method then call the base logic and just provide mine afterwards. Simple as that and here is the code:

protected override void Submit_Click(object sender, EventArgs e)
base.Submit_Click(sender, e);
// Reads the fields controls on the form
foreach (IFormFieldControl fieldControl in this.FieldControls)
// Here you shall put your logic to process the field responses and handle them in a way you would like to
var field = fieldControl as FieldControl;
var value = field.Value;
string title = field.Title;

// In this section, I just create a literal and place it on the main ErrorsPanel of the widget, just to show you that the values are handled properly
Literal theLiteral = new Literal();
theLiteral.Text = String.Format("<p><strong>Value: </strong>{0} >>> <strong>Title: </strong>{1}</p>", value.ToString(), title);
ErrorsPanel.Visible = true;

What is step 3? Sorry, no third step – there are only two. I told you that is going to be easy!

Formal Closing

We are almost done, but there are some important closing details to note about using the code from this blog post.

To use this code, you will have to register the control as Sitefinity widget. The easiest way is to use Sitefinity Thunder with your Visual Studio. If you still don’t have this tool installed in your IDE, please do it because it is really great addition to any ASP.NET development for Sitefinity. In case you would like to install this tool, here are some instructions.

That’s it. Go ahead and download the file of the control. Let us know what you think. I hope that if you have to extend the behavior of the forms module, this resource will help you with the task.


Leave a comment
  1. Steve Jun 22, 2012
    Is there a way to get the SubmissionID in the custom control somehow?
  2. Stewart Jul 11, 2014

    How do you read Section headers. They are not in the FieldControls collections. 


  3. Peter Marinov Jul 11, 2014

    Hi Stewart,

    The FieldControls collection consists only of input form fields and it excludes all form controls, which don't carry on user input such as the form layout controls, the submit button, the error labels and the section headers.In order to get the Section headers, you should loop though the collection of all form controls available in the FormData object.

    Here is code that will give you access to the section headers:



  4. Ed Mar 03, 2015
    What namespaces do I need to include in order to use this?

    Leave a comment