Create Custom Nintex Form Controls That Any Nintex Form Designer Will Love!

Have you ever wished you could pass values to a Nintex Form via the URL, like you might do in a web application? Maybe you’ve already been doing this with JavaScript working behind-the-scenes with Nintex Forms. But as you might know, that can get tedious to maintain, especially when your Nintex form designers need to alter your JavaScript to add new forms or new fields.

Well, there’s a better way! Nintex has provided a Nintex Forms Software Development Kit (SDK) so that you may create your own Nintex Forms controls in C# that can be dragged onto a form by the designer and configured just like any other Nintex Forms control.

In this post, I’ll show you how to build a working custom control that will automatically populate a text box based on a value in the URL query string.

When I develop a Nintex Forms control, I like to have a project with a minimum of three classes:

  • a class derived from FormControl,

  • a class derived from FormControlProperties,

  • and a user control that usual contains the basic functionality.

The separation of the ASP.NET User Control from the Nintex Form Control allows me to develop and test the functionality of the control in a local development environment before testing it within a Nintex Forms server context.

In the case of our Query String control, this means we will have:

  • A QueryStringTextBox class derived from FormControl,

  • a QueryStringTextBoxProperties class derived from FormControlProperties,

  • and a QueryStringTextBoxUserControl class derived from an everyday ASP.NET user control.

The first class implements the core methods needed by the Nintex form to present the control in the Forms designer, as well as present the control to the user in a production context. The second control-properties class encapsulates the Control Settings available to the forms designer when configuring the control in Nintex.

The third class is a ASP.NET user control that can be developed and tested outside of Nintex Forms and on a non-SharePoint development machine, and provides the functionality behind the custom form control. Ultimately this user control will be placed in a an empty SharePoint project, along with the following assemblies required by Nintex Forms: Microsoft.SharePoint, Microsoft.SharePoint.Client.ServerRuntime, Nintex.Forms, Nintex.Forms.Sdk, System.Runtime.Serialization, and System.Web.

The Query String Text Box control can be dropped on a form like a normal single line text box, and it looks for a value in the current URL query string based on a field name you give it.

In my example, I am binding the form control to a list column named AffiateId and a query string field named AffId:


Since the Query String Text Box binds the AffId query string value to the text box, when we open a new Nintex form, edit form, or display form, the value from the URL is placed in the text box. This allows me to have a link from another part of my application to, say, a New Form page and provide the affiliate ID in the URL for the link. For instance, a URL /Lists/Products/NewForm.aspx?AffId=pretzels will bring the user to the Products new form with “pretzels” already populated for the Affiliate ID text box.

Figure 3 "pretzels" is pre-populated from the URL

Since the text box is bound to the SharePoint list column, the value will be saved when the Nintex Form is saved.

Using a Nintex form control like this allows your Nintex Forms design team to reproduce and maintain this functionality on any other forms they create. All they have to do is drop the control on the form and set its properties. They don’t have to know anything about using or maintaining JavaScript in order to get the results they need out of a Nintex Forms application!

Want to learn more about the Productivity Controls that we've created for Nintex Forms? If so, click here.

Try our Productivity Controls, risk-free for 45 days!

Got questions?  Call 614-737-3743.