Field validations

You can easily enable validation for the field values by using the attributes provided.
Sitefinity CMS supports the following attributes:
  • EmailAddress
    Validates an email address.
  • MaxLength
    Specifies the maximum length of array or string data that is allowed.
  • MinLength
    Specifies the minimum length of array or string data that is allowed.
  • Range
    Specifies the numeric range limits for the value of a data field.
  • RegularExpression
    Specifies that a data field value in ASP.NET Dynamic Data must match the specified regular expression.
  • Required
    Specifies that a data field value is required.
  • StringLength
    Specifies the minimum and maximum length of characters that are allowed in a data field.
  • Url
    Provides URL validation.

To apply validation attributes, use the following code sample:

These validation attributes are provided in Microsoft's ASP.NET System.ComponentModel.DataAnnotations Namespace.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Tags

Was this article helpful?

Next article

Conditional fields