Try our conversational search powered by Generative AI!

XForm in block - get reference to the block in AfterSubmitPostedData event

Vote:
 

Hi,

I posted this question before and got no response, maybe the description was vague.

In a project I'm currently working with, we have a Block which contains a XForm property. Now I'm about to fiddle with the AfterSubmitPostedData-event in the Initialization-module for this addon. This step is working fine, the event is executed as expected.

1
2
3
4
public void Initialize(InitializationEngine context)
        {
            XFormActionHelper.AfterSubmitPostedData += XFormControlOnAfterSubmitPostedData;
        }

The problem i face is that i cannot get reference to the block that the XForm lies in. The XFormDataEventArgs doesn't have a reference to the block, just FormData.PageGuid which is of course null. And the sender is null. Is there a way of getting the reference of the block in the event?

1
2
3
4
5
6
7
8
private void XFormControlOnAfterSubmitPostedData(object sender, XFormDataEventArgs e)
        {
            // e.FormData.PageGuid is null because the form is inside a block
            var map = PermanentLinkMapStore.Find(e.FormData.PageGuid) as PermanentContentLinkMap;
            ..
            ..
            ..
        }

Thanks for your help

#114369
Dec 11, 2014 8:14
Vote:
 

We usually put the XForm events in the block control/controller itself, then we have access to CurrentBlock.

#117076
Edited, Feb 11, 2015 9:35
* 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.