Hello,
Please take a look at following code snippet that shows how you can get name/value pairs stored as options:
DataClassInfo info = DataClassInfoProvider.GetDataClass("<class name>");
if (info != null)
{
CMS.FormEngine.FormInfo fi = new CMS.FormEngine.FormInfo(info.ClassFormDefinition);
CMS.FormEngine.FormFieldInfo ffi = fi.GetFormField("<field name>");
string a = ValidationHelper.GetString(ffi.Settings["options"], "");
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
xmlDoc.LoadXml("<xml>" + Convert.ToString(ffi.Settings["options"]) + "</xml>");
System.Xml.XmlNode xmlNode = xmlDoc.FirstChild;
if (xmlNode.HasChildNodes)
{
foreach (System.Xml.XmlNode itemNode in xmlNode.ChildNodes)
{
string text = CMSContext.CurrentResolver.ResolveMacros(XmlHelper.GetAttributeValue(itemNode, "text"));
string value = CMSContext.CurrentResolver.ResolveMacros(XmlHelper.GetAttributeValue(itemNode, "value"));
}
}
}
Best regards,
Michal Legen