在Kentico 7中,我正在尝试根据提交的替代表单执行操作。
public partial class CMSModuleLoader
{
private class ObjectEventsAttribute : CMSLoaderAttribute
{
public override void Init()
{
ObjectEvents.Insert.Before += My_Create_Account_Page;
}
private void My_Create_Account_Page(object sender, ObjectEventArgs e)
{
if (e.Object is BizFormItem && e.Object != null)
{
BizFormItem formEntry = (BizFormItem)e.Object;
BizFormInfo form = formEntry.BizFormInfo;
if (form.FormName == "MyOpenAccount")
{
// somehow determine which alternative form this is
// do stuff with the fields in that alternative form
}
}
}
}
}
我上下文档并没有找到解决方案。我可以添加一个字段,我会给出alt的默认值。表单名称,但这打开了编辑器删除该字段,它仍然没有告诉我其他字段在替代形式。还有其他想法吗?
答案 0 :(得分:1)
如果您使用ObjectEvents方法,我担心无法访问替代表单名称。但是这些信息被“在线表单”(BizForm)webpart所知。所以你可能需要自定义它或创建一个副本。 Bizform控件具有AlternativeFormFullName
属性,您可以挂钩其中一个事件,如OnAfterSave
。