Try our conversational search powered by Generative AI!

Xforms - need labels in email

Vote:
 

We are using Xforms for order forms. The forms are quite lengthy. However, we the data is sent in an email it's almost impossible to read. I would like to put the data in sections. Ideally wiith space between the different kinds of data and e.g. with the headers as used in the form. How can this be done? i reckon we need to add more fields when creating the form itself? But how? 

#74185
Aug 22, 2013 8:48
Vote:
 

Hi Malin,

It might be worth considering hooking into the BeforeSubmitPostedData event, which would allow you access all the data contained within a particular form submission. You could then implement custom formatting and handling (e.g email sending etc) of the data, as required. 

A crude example of hooking into a Form post and accessing the data:

public void XForm_BeforeSubmitPostedData(object sender, SaveFormDataEventArgs e)
{
        XFormControl control = (XFormControl)sender;

        if (control.FormDefinition.FormName == "Contact Form")
        {
                var account = new AccountEntity
                {
                        Name = control.Data.Data.GetElementsByTagName("Company")[0].InnerText,
                        Industry = control.Data.Data.GetElementsByTagName("Sector")[0].InnerText,
                        NoOfEmployees = int.Parse(control.Data.Data.GetElementsByTagName("NoOfEmployees")[0].InnerText)
                };

                //Do stuff with the AccountEntity etc.

        }
}

Hope this helps.

 

#74207
Aug 22, 2013 13:27
Vote:
 

Cool! Thanks for fast reply. I'll definitely check this.

#74236
Aug 22, 2013 16:27
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.