Hello,
This will require to create a
custom macro (
custom transformation method), which will get the class form definition according to the selected value. Please find some API example on manipulating the class form definition below:
using CMS.FormEngine;
using CMS.SettingsProvider;
...
DataClassInfo dci = DataClassInfoProvider.GetDataClass("cms.user");
if (dci != null)
{
FormInfo fi = new FormInfo(dci.ClassFormDefinition);
FormFieldInfo ffi = fi.GetFormField("UserIsExternal");
if (ffi != null)
{
// now you can work with the FormFieldInfo
FormFieldDataTypeEnum dataType = ffi.DataType;
}
}
Here is some example code for the object CMS.Article and the field MyDropdown:
//getting the DataClassInfo for the given object (e.g. cms.article)
CMS.SettingsProvider.DataClassInfo di = CMS.SettingsProvider.DataClassInfoProvider.GetDataClass("CMS.Article");
//creating a new FormInfo object
CMS.FormEngine.FormInfo fi = new CMS.FormEngine.FormInfo(di.ClassFormDefinition);
//getting the field
CMS.FormEngine.FormFieldInfo ffi = fi.GetFormField("MyDropdown");
//acessing all the fields options
Label1.Text = ffi.Settings["Options"].ToString();
Best regards,
Boris Pocatko