Get Form Field Options in custom form control

Louise O'Hara asked on May 25, 2016 16:16

Hi

I have created a custom form control and I would like to use the following code to get a list of radio button options however I am unsure how to find the form class name or the field name of the current form that is using the custom form control.

protected string[] GetFormFieldOptions()
{
DataClassInfo dci = DataClassInfoProvider.GetDataClassInfo("BizForm.Test");
if (dci != null)
{
//Get the data from the form field
FormInfo fi = new FormInfo(dci.ClassFormDefinition);
FormFieldInfo ffi = fi.GetFormField("Question1");
string[] Q1Answers = ffi.Settings["Options"].ToString().Split('\n');
return Q1Answers;
}
return null;
}

Louise

   Please, sign in to be able to submit a new answer.