BIZFORM

Avinash P asked on August 16, 2016 13:55

I dont know which name space is used to define the below event in event handler (KENTICO 7.0) BizFormItemEvents.Insert.After += Insert_After;

While saving the online form whether the below event is called or not in event handler? DocumentEvents.Insert.Before += Document_Insert_Before;

thanks

Correct Answer

Brenden Kehren answered on August 16, 2016 14:28

You use ObjectEvents and check the ObjectType like so:

public override void Init()
{
    ObjectEvents.Insert.After += Insert_After;
}

private void Insert_After(object sender, ObjectEventArgs e)
{
    switch (e.Object.ObjectType.ToLower())
    {
        case "bizformitem.bizform.yourbizformcodename":
            string columnValue = e.Object.GetStringValue("ColumnName", "");
            // do your work
            break;
    }
}
1 votesVote for this answer Unmark Correct answer

Recent Answers


Avinash P answered on August 16, 2016 15:14

[CustomForm]
public partial class CMSModuleLoader
{
    private class CustomForm : CMSLoaderAttribute
    {
        public override void Init()
        {
            //base.Init();
            ObjectEvents.Insert.After += Insert_After;
            DocumentEvents.Insert.Before += Document_Insert_Before;
        }
        private void Insert_After(object sender, ObjectEventArgs e)
        {
            switch (e.Object.ObjectType.ToLower())
            {
                case "bizformitem.bizform.yourbizformcodename":
                    string columnValue = e.Object.GetStringValue("ColumnName", "");

                    e.Object.Update();
                    // do your work
                    break;
            }
        }

The above events is not executed when saving the form. I don't know whether we need to configure the even handler or not ?

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on August 16, 2016 16:12

Modify a few things,

change [CustomForm] to [CustomFormModule].

Change private class CustomForm to public class CustomFormModuleAttribute

0 votesVote for this answer Mark as a Correct answer

Avinash P answered on August 17, 2016 06:58

Thanks for the answer.

ObjectEvents.Insert.After += Insert_After; Method calls only Initialization of page.

i need to this method call for whenever form data is submitted. i want to change my form fields data in this method.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.