Sending Form Data to External Database?

Posted by Community Admin on 04-Aug-2018 15:52

Sending Form Data to External Database?

All Replies

Posted by Community Admin on 15-Dec-2012 00:00

Hi everyone,

How do I send form data to an external database of MS SQL? I do not want the form data to go to the Sitefinity database upon submit. Can the forms widget be more expansive in functionality? It seems too limited to only send data to the Sitefinity database. Is anyone else running into this issue? What documentation is available on this topic?

I appreciate any help and guidance that can be offered. Thank you,

Maria

Posted by Community Admin on 15-Dec-2012 00:00

It's actually pretty easy

Create a new class and inherit from the existing forms control

public class FormsControlCustom : FormsControl

This inside of Initialize controls you can hook into the Save events and do whatever custom code you want to put the data somewhere else.

protected override void InitializeControls(GenericContainer container)
        
            if (!SystemManager.IsDesignMode)
            
                //Hide the form if JS is disabled, it'll let them bypass the required fields.
                base.InitializeControls(container);
                this.BeforeFormSave += new EventHandler<CancelEventArgs>(FormsControlCustom_BeforeFormSave);
            
        

This thread is closed