Hi,
We have been resolving this question with Matt via email. In the end we used a different control that is better suited for this purpose:
<cms:CMSForm ID="cmsForm" runat="server" IsLiveSite="true" />
With one of these this setup method called from OnInit handler for Edit dialog:
protected bool ShowEditForm(string aliasPath = "/aaPage")
{
NodeSelectionParameters parameters = new NodeSelectionParameters()
{
AliasPath = aliasPath,
CultureCode = "en-US",
CombineWithDefaultCulture = true,
ClassNames = "custom.aaCustom"
};
TreeProvider tree = new TreeProvider();
var editedObject = tree.SelectSingleNode(parameters);
//var editedObject = DocumentHelper.GetDocument(parameters, new TreeProvider());
if (editedObject == null)
{
LogInfo("No object found");
return false;
}
LogInfo("Object: " + editedObject.TypeInfo.ObjectClassName);
FormInfo formInfo = FormHelper.GetFormInfo("custom.aaCustom", true);
if (formInfo == null)
{
LogInfo("No form found");
return false;
}
LogInfo("Form: " + formInfo.ItemsList.Count + " fields");
cmsForm.DocumentManager.Mode = FormModeEnum.Update;
cmsForm.NodeID = editedObject.NodeID;
cmsForm.LoadForm(true);
cmsForm.SubmitButton.Visible = true;
return true;
}
Or this one for new Page dialogue.
protected bool ShowInsertForm()
{
//var editedObject = UserInfoProvider.GetUserInfo("administrator");
NodeSelectionParameters parameters = new NodeSelectionParameters()
{
AliasPath = "/aaPage",
CultureCode = "en-US",
CombineWithDefaultCulture = true,
ClassNames = "custom.aaCustom"
};
TreeProvider tree = new TreeProvider();
var editedObject = tree.SelectSingleNode(parameters);
//var editedObject = DocumentHelper.GetDocument(parameters, new TreeProvider());
if (editedObject == null)
{
LogInfo("No object found");
return false;
}
LogInfo("Object: " + editedObject.TypeInfo.ObjectClassName);
FormInfo formInfo = FormHelper.GetFormInfo("custom.aaCustom", true);
if (formInfo == null)
{
LogInfo("No form found");
return false;
}
LogInfo("Form: " + formInfo.ItemsList.Count + " fields");
DataClassInfo documentClass = DataClassInfoProvider.GetDataClassInfo(CurrentPageInfo.NodeClassID);
if (documentClass == null)
{
LogInfo("No class found");
return false;
}
LogInfo("Class: " + documentClass.ClassName);
cmsForm.DocumentManager.Mode = FormModeEnum.Insert;
cmsForm.DocumentManager.NodeID = 0;
cmsForm.DocumentManager.ParentNodeID = CurrentDocument.NodeID;
cmsForm.DocumentManager.NewNodeClassID = CurrentPageInfo.NodeClassID;
cmsForm.FormName = cmsForm.DocumentManager.NewNodeClassName + ".default";
cmsForm.LoadForm(true);
cmsForm.SubmitButton.Visible = true;
return true;
}