SaaS CMS has officially launched! Learn more now.

XForms events not fired?


I'm trying to hook up to the BeforeSubmitPostedData event. I'm trying to use the following:

    public class XFormsInitialization : IInitializableModule
        public void Initialize(InitializationEngine context)
            XFormControl.ControlSetup += XFormControlOnControlSetup;

        private static void XFormControlOnControlSetup(object sender, EventArgs eventArgs)
            var control = (XFormControl)sender;
            control.BeforeSubmitPostedData += ControlOnBeforeSubmitPostedData;

        private static void ControlOnBeforeSubmitPostedData(object sender, SaveFormDataEventArgs eventArgs)
            if (eventArgs.FormData.ChannelOptions.HasFlag(ChannelOptions.Email))
                // do stuff
                //eventArgs.FormData.ChannelOptions = eventArgs.FormData.ChannelOptions.Remove(ChannelOptions.Email);

        public void Preload(string[] parameters) { }

        public void Uninitialize(InitializationEngine context)
            XFormControl.ControlSetup -= XFormControlOnControlSetup;

The event is never fired. I'm uising MVC. Is this just a WebForms thing?

I've also tried to hook up to the event with XFormActionHelper.BeforeSubmitPostedData. The event fires correctly, but the ChannelOptions are empty.

Jun 25, 2014 16:10

Yeah... I believe this is the same thing I ran into when I was fiddling around with xforms.

a) Yes, use XFormActionHelper
b) XFormActionHelper is broken.

I remember talking to Sharam or Björnfot about it who filed a bug for it (I think), though I can't find it in the bug list.
I have a workaround for it that I built, I'll just have to find it. I'll be back.

I'm back.

Here's a zip with the interesting bits. Pleas yell if I forgot any vital parts.

Edited, Jul 09, 2014 14:24

Nice! Seems like you've made the same conclutions as me. I'll think this will do the trick. Thanks.

I'll try it out, and will let you know if some vital parts are missing.

Jul 09, 2014 15:22
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.