JAG
JAG

Reputation: 685

Use Ektron API to conect an event to fire on smartform submit

I have an Ektron smart form on a masterpage. I want to call some custom C# code upon submission of a specific smart form.

Is this possible? is there an other way of doing it?

or indeed a way to setup a listener when smart form entry is added to the table.

Upvotes: 0

Views: 46

Answers (1)

JAG
JAG

Reputation: 685

After some investigation - the best way forward for this seems to be to use a 'strategy'

add this to the ObjectFactory.config

<add name="Form">
      <strategies>
        <add name="SmartFormStrategy" type="MyNamespace.SmartFormStrategy" />
      </strategies>
</add>

then a new class along these lines

 public class SmartFormStrategy : FormStrategy
        {
            public override void OnAfterSubmit(FormData formData, FormSubmittedData submittedFormData, string formXml,
                CmsEventArgs eventArgs)
            {
                var formFieldDataItem = submittedFormData.DataItems.ToList().FirstOrDefault(x => x.FieldName == "EktFormId");

//act upon the form submit results
              }
    }

Upvotes: 0

Related Questions