Reference - System form components

This page lists all components that are available for the form builder by default in new installations of Kentico. For details on how to programmatically configure these components when used in the widget configuration dialog, or in the form builder, see Defining form component properties

In addition to the default system components, developers can create custom components for the form builder.

Identifiers of system form components

You can access the identifiers of system form components in your code via the IDENTIFIER constant exposed by each form component class. For example, the identifier is required when using the EditingComponent attribute to set the editing interface for a property.

Form componentForm component classTypeDescription
CheckboxCheckBoxComponentboolCheckbox field that saves a boolean value (true for a selected checkbox, false for a cleared checkbox).
Consent agreementConsentAgreementComponentGUID

Checkbox field that allows users to give agreements to with a pre-selected consent. Displays the selected consent's short text next to the checkbox. When a visitor selects the consent checkbox and submits the form, the system creates a corresponding consent agreement for the given contact and stores the agreement's identifier (GUID) into the form field.

To learn more, see: Working with consents on MVC sites

Drop-down listDropDownComponentstring

Drop-down selector offering multiple options. Only one option can be selected.

To learn how to configure options for this component programmatically, see Configuring selector editing components.

EmailEmailInputComponentstringInput field for entering one or more email addresses. 
File uploaderFileUploaderComponentstring

Field that allows users to submit a single file as part of the form data. The submitted files are stored on the file system and the corresponding form field stores the file's name.

The component can be further configured using existing system settings, see Configuring the File uploader for more information.

Numeric inputIntInputComponentintTextbox input field for entering whole numbers. 
Radio buttonsRadioButtonsComponentstring

Selector offering multiple options in the form of radio buttons. Only one option can be selected.

To learn how to configure options for this component programmatically, see Configuring selector editing components.

reCAPTCHA

_________________

RecaptchaComponentstring

A validation element based on reCAPTCHA, which allows forms to tell apart humans and computers. If the reCAPTCHA validation fails, the form cannot be submitted.

Requires users to click a checkbox indicating they are not a robot. This either passes the user immediately or challenges them to validate whether or not they are human (using an additional image selection or audio test).

To learn how to set up the reCAPTCHA component for your site, see: Configuring reCAPTCHA

Text areaTextAreaComponentstring

Input field that allows users to enter text into an area with adjustable size.

Text inputTextInputComponentstringTextbox input field.
U.S. phone numberUSPhoneComponentstring

Input field for a phone number in the standard US format, i.e. (132) 456-7890.

The form components listed on this page are available for the form builder.

For information about additional form (editing) components available for the properties of page builder components, see Page and media selectors for page builder components.

Configuring selector editing components

When using selector components as editing components, configure the DataSource property to define their options. You can either specify a list of values, or a semicolon-delimited list of values and text. Each option needs to be entered on a separate line. For example:

        // Assigns a selector component to the SelectedOption property
        [EditingComponent(DropDownComponent.IDENTIFIER)]
        // Configures the list options available in the selector
        [EditingComponentProperty(nameof(DropDownProperties.DataSource), "cz;Czech Republic\r\nusa;United States")]
        public string SelectedOption { get; set; }
Alternatively, you can load the items from a dynamic data source. See Using a dynamic data source with selector components for more information.

Configuring the File uploader

The following settings from the Settings application allow you to configure the behavior of the File uploader form component:

  • System -> Files -> Custom form files folder – sets a custom folder used to store files uploaded using the form component. See Settings - Files.
  • System -> Files -> Upload extensions – allows you to specify a list of file extensions users are allowed to upload using the form component. See Settings - Files.

All files are automatically synchronized across the live-site and administration projects using web farmsIn cases where you expect large volumes of user data to be uploaded, or you wish to keep all files in a shared location to prevent needless duplication, it is beneficial to map the form files folder to a shared location.

The remainder of this sections details further configuration of the form component and corresponding system settings:

Limiting the maximum uploadable file size

You can control the maximum file size of files uploaded using the form component via the maxRequestLength and maxAllowedContentLength attributes in the live-site application's web.config file. If both of these attributes are specified, the smaller value is prioritized. The component will automatically prevent people from uploading files larger than the specified limit via a JavaScript notification.

<system.webServer>
	<security>
    	<requestFiltering>
        	<requestLimits maxAllowedContentLength="MAXSIZE_IN_BYTES" />
        </requestFiltering>
    </security>
</system.webServer>
<system.web>
	<httpRuntime maxRequestLength="MAXSIZE_IN_KILOBYTES" />
</system.web>

If neither of the attributes is present in the application's web.config file, the default upload limit is set to 4 MB.

Scoping the upload limitation to the File uploader component

If you do not wish to set the maximum request/content length globally for the entire application, you can scope the configuration to only affect the File uploader component by using a location element with its path attribute set to the Kentico.FormBuilder/FormFileUploader route. This ensures the size limitations apply only to files uploaded using the File uploader component:

<location path="Kentico.FormBuilder/FormFileUploader">
	...
</location>

Denial of service protection

To expedite the form submission process, all files selected using the File uploader component are immediately uploaded and stored in a dedicated folder on the server. This occurs independently of the form submission process. After the form is submitted, the system moves the corresponding file (currently selected in the File uploader component) to the folder used to store form data on the server.

As a measure of protection against denial of service attacks, for example by repeatedly uploading large files without submitting the form, the system limits the size of the temporary folder used to store the uploaded files. The folder size limit, set to 500 MB by default, can be configured by adding the CMSTemporaryUploadFilesFolderSizeLimit key into the <appSettings> section of the MVC project's web.config file. If the folder size limit is exceeded, the system prevents users from uploading additional files and logs an exception to the event log.

<!-- Sets the folder size limit to 1000 MB -->
<add key="CMSTemporaryUploadFilesFolderSizelimit" value="1000">

The system deletes the contents of the temporary folder once every two hours using a scheduled task. If you wish to modify this behavior, for example in cases where you expect higher volumes of form submissions containing large files, you can override the default two hour interval by configuring the CMSDeleteTemporaryUploadFilesOlderThan setting key in the <appSettings> section of the MVC project's web.config file.

<!-- Sets the folder cleanup period to one hour -->
<add key="CMSDeleteTemporaryUploadFilesOlderThan" value="1">

Configuring reCAPTCHA

You need to register your site to use the reCAPTCHA API and obtain a pair of API keys:

  1. Go to https://www.google.com/recaptcha/admin and sign in with your Google account.
  2. Select the reCAPTCHA v2 type (other reCAPTCHA types are not supported by default).
  3. Fill in all required details, including the domain where your site is running (the presentation domain of your MVC live site).
  4. Copy your Site key and Secret key.

Next, enter your site's reCAPTCHA API keys into Kentico:

  1. Open the Settings application in the administration interface.
  2. Navigate to the Security & Membership -> Protection settings category.
  3. Under CAPTCHA settings, paste the API keys into the reCAPTCHA site key and reCAPTCHA secret key settings respectively.
  4. Save the settings.

    Tip: If you run multiple sites in your Kentico instance, you can switch between them using the Site selector and enter different API keys for each site.

With the API keys entered into the system, the reCAPTCHA form component now works in forms. When composing forms, the form builder interface allows users to configure additional properties for specific reCAPTCHA fields:

  • Theme – sets the appearance of the reCAPTCHA element (Light or Dark).
  • Size – sets the size of the reCAPTCHA element (Normal or Compact).
  • Type – sets the type of challenge used if the initial noCAPTCHA validation fails (Image or Audio).

Using multiple reCAPTCHAs on the same page

The system does not support the use of multiple reCAPTCHA fields within the same form. You can have multiple different forms with a reCAPTCHA field on the same page.


Was this page helpful?