How to add a choicefield dropdown to form properties connectors section using FormsConnectorDefinitionsExtender

0 Answers 0 Views
Let's talk about telerik (the good and the bad) Miscellaneous Telerik Trainer
Ambey
Top achievements
Rank 1
Ambey asked on 06 Nov 2025, 12:12 PM
To add a ChoiceField dropdown in the Form Properties → Connectors section using FormsConnectorDefinitionsExtender, you need to extend the connector definitions and define your field properly. Here's a step-by-step guide with an example:


---

1. Implement FormsConnectorDefinitionsExtender

You need to create a class that implements IFormsConnectorDefinitionsExtender (or the relevant extender interface depending on your framework/version).

using Telerik.Sitefinity.Forms.Connector;
using Telerik.Sitefinity.Forms.Model;
using System.Collections.Generic;

public class CustomConnectorExtender : IFormsConnectorDefinitionsExtender
{
    public void Extend(IEnumerable<FormConnectorDefinition> connectorDefinitions)
    {
        foreach (var connectorDef in connectorDefinitions)
        {
            // Example: Add a ChoiceField dropdown to a specific connector
            if (connectorDef.Name == "MyCustomConnector")
            {
                connectorDef.Properties.Add(new ChoiceFieldDefinition
                {
                    Name = "Category",
                    DisplayName = "Select Category",
                    Description = "Choose a category for the submission",
                    Choices = new List<ChoiceItem>
                    {
                        new ChoiceItem { Text = "Option 1", Value = "1" },
                        new ChoiceItem { Text = "Option 2", Value = "2" },
                        new ChoiceItem { Text = "Option 3", Value = "3" }
                    },
                    Required = true,
                    DefaultValue = "1"
                });
            }
        }
    }
}


---

2. Register the Extender

You need to register the extender so the platform picks it up. This usually goes into a Module class or Global.asax depending on your CMS/framework:

protected void Application_Start(object sender, EventArgs e)
{
    FormsConnectorDefinitionsExtender.RegisterExtender(new CustomConnectorExtender());
}


---

3. Key Points

ChoiceFieldDefinition is used to render a dropdown in the Connectors properties.

Choices is a list of ChoiceItem objects where you define the Text and Value.

DefaultValue can be set to preselect an option.

Required makes the dropdown mandatory.

Make sure the connector name (connectorDef.Name) matches the connector you are extending.



---

This approach ensures that when a user opens your custom connector in the Form Properties → Connectors section, they will see a dropdown field with the specified choices.


---

If you want, I can also provide a version that supports dynamic values, so the dropdown populates from a database or API instead of being static. Do you want me to do that?

No answers yet. Maybe you can help?

Tags
Let's talk about telerik (the good and the bad) Miscellaneous Telerik Trainer
Asked by
Ambey
Top achievements
Rank 1
Share this question
or