1
在Kentico 7中,我尝试根据提交的替代表单执行操作。以编程方式访问Kentico替代表单属性
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的默认值。表单名称,但是这让我向删除该字段的编辑者开放,并且它仍然不会告诉我其他字段在替代形式中。任何其他想法?
这可能是有用的,如果我们可以以某种方式使用该字符串来获取属于该替代形式的字段。在这一点上,我认为这是不可能的。 – user1269310 2014-09-22 17:10:58
绝对有可能。包含'AlternativeFullName'属性的同一个控件也具有'Fields'属性,该属性(一旦加载了bizform)包含一个表单/替代形式的字段。 – mivra 2014-09-23 08:53:47
如果我没有记错的话,那会给出表单的字段,但是不会让我看到哪个字段用于替代形式,这是我的(未详细描述的)目标。谢谢,不过。 – user1269310 2014-09-23 17:06:46