Validating Fields

There are a few built in validators available for template developers so that they can easily configure a content type field to get validated whenever it is saved. These validators can be configured for a content type field by defining certain predefined parameters. Below is a table describing the available validation schemes.

Parameter nameValueStruts message keyDescription

com.ndc.usercontent.constraint

notEmpty

validate.error.empty

Validates the field ensuring that it is not empty

com.ndc.usercontent.constraint

isEmail

validate.error.isEmail

Validates the field ensuring that the input value is an email address

com.ndc.usercontent.constraint

minLength

validate.error.minLength

Validates the field ensuring that the input value has the minimum number of characters. Example: minLength(10)

com.ndc.usercontent.constraint

maxLength

validate.error.maxLength

Validates the field ensuring that the input value has at most the configured number of characters. Example: maxLength(10)

com.ndc.usercontent.constraint

isNumber

validate.error.isNumber

Validates that the field value is a number

com.ndc.usercontent.constraint

isPhoneNumber

validate.error.isNumber

Validates the field ensuring that the input value is a valid phone number

com.ndc.usercontent.constraint

userNameFormat

validate.error.userNameFormat

Ensures that the input value consists of only letters and digits

com.ndc.usercontent.constraint

dateInPast

validate.error.dateNotInPast

Ensures that the input date value is of a past date. The format must be: 2006-11-04T10:46:29

com.escenic.community.constraint.regEx

A valid Java regular expression that can be compiled with: java.util.regexf.Pattern

validate.error.regex

Validates the input value with the configured regular expression