Setup & Configuration

TextField Content Control

TextField content control displays one line of plain text. It is useful for displaying headers, titles, and other fields where you would not want to give users the ability to change text formatting.

By default the string is HTML-encoded.

Besides properties common for all ElasticWCM Content Controls the TextField control has following properties:

Property Name Default Value Description
DefaultText Empty String A text that should be displayed until content is edited
HtmlEncode true Determines if the string will be Html Encoded when displayed on the page.
Required false Validation parameter for Page Editor screen. Indicates if content is required for this field. If true - the Page Editor will display a validation error message until some content is entered in the textbox.
RequiredErrorMessage Empty String Required field validation error message (optional)
MaxLength 0 Validation parameter for Page Editor screen. Indicates that the string should not be longer than specified number of characters. 0 means maximum length (30,000 characters)
MaxLengthErrorMessage Empty String Maximum length validation error message (optional)

DefaultText

DefaultText is a text that will be displayed on the page before you edit it in the Page Editor. There are two equivalent ways of providing default text:

<ewcm:TextField runat="server" FieldName="Simple Text">
This is multi-line text
without any formating

</ewcm:TextField>

and

<ewcm:TextField runat="server" FieldName="Simple Text" DefaultText="This is some default Text" / >

HtmlEncode

By default the content of the TextField will be Html-encoded when displayed on the page. This is the recommended most secure configuration. If for some reason you need to display row unencoded text you can set the value of HtmlEncode parameter to false.

Required

This is a validation parameter for the Page Editor screen. It indicates if content is required for this field. If true - the Page Editor will display a validation error message until some content is entered in the textbox. The displayed message can be provided in the RequiredErrorMessage property.

RequiredErrorMessage

This property allows you to provide a validation error message for the Required validation parameter. If no custom message is provided - the default message "Required field" will be displayed.

MaxLength

This is a validation parameter for the Page Editor screen. It indicates that the string should not be longer than specified number of characters. MaxLength=0 means maximum length (30,000 characters). A custom validation error message can be provided in the MaxLengthErrorMessage property.

MaxLengthErrorMessage

This property allows you to provide a validation error message for the MaxLength validation parameter. If no custom message is provided - the default message "Maximum length {0} characters" will be used. The actual number of characters will substitute "{0}" token.