kentico_borisp
-
9/21/2012 1:36:51 AM
RE:How to make autoresponder get the text value of dropdownList entries
Hello,
The easiest way would be to modify the dropdown values to:
value1;value1 value2;value2 value3;value3
Otherwise you will need to create a macro or custom transformation function, which would get the data from the database by accessing the class definition and extracting the name. Here is some sample code, which could be used after siome modification:
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(ÜserIsExternal"); 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[Öptions"].ToString();
Best regards, Boris Pocatko
|