Creating Datatypes

Creating and Managing Fields

Each data type might have one or more fields. You should add at least one field when creating a data type. The number and types of the fields you can add depend on your purposes.

For example, if you have a form on a web page where the user enters his personal data, you might have text fields for her or his first and last names, email address and phone number, a large text field (text area) for her or his address, and a date field for her or his date of birth.

When you add a field to a data type, you work with its settings editor in the working area. Each field has its basic and advanced properties grouped each on its corresponding tab in the settings editor.

You should set most of the basic properties manually while the advanced properties are set automatically for you with default values. However, if you want to fine-tune a field, you will probably set the advanced properties manually, too. For example, you can select another widget for the field.

Each field you add should be of a certain type. The type determines what kind of data the field can hold. Based on the field type, some of the field’s properties may differ. For example, for a string type you should specify the string’s maximum length, for a decimal type – the number of decimal places, and for a data reference – its reference type.

The field type also determines what kind of a widget will be used for this field on the form. For example, with a string field intended for short texts, a text box widget will be most likely used, while the date field will use a date selector widget.

(When creating global data types and page data folders, you can manage the name and the type of the key field named “Id” by default. Please see “Managing key fields” for more information.)

Let’s first find out what basic and advanced properties you can set when adding a field to a data type with a closer look at field types.


Basic Field Properties

When you add a field, you should set a number of its basic properties such as its name, label, help text, position and type as well as indicate whether this field is required or optional.

Figure 11: Basic Field Properties

The following is the list of these basic properties:

Field Types

Property

Definition

Name

The name of the field used by C1 CMS to identify this field. The field cannot contain the space character or any other special characters.

Label

The name of the field displayed to the user in GUIs as a field label. It appears as a field label when adding a data item to a data type or on the forms based on these data types. If you do not specify the label it will copy the value of the Name field.

Help

Short help text associated with this field. It pops up when the user clicks the help button next to the field on a form.

Position

The position of the field with regards to other fields. By default, the Position is set to Last, which means the field will be added in the end of the field list.

Field Type

The type of the field that determines what data this field can hold.

Optional

This property indicates whether the input in this field is required or optional.

 

Based on the field type, you might need to set an additional property specific to this type (e.g. String maximum length). These additional properties are discussed in the following section dedicated to the field types.

Field Types

For each global data type, C1 CMS allows you to create fields of the following types:

  • String
  • XHTML
  • Integer
  • Decimal number
  • Date
  • Boolean
  • Unique Identifier (GUID)
  • Data reference

When you select the string, decimal number or data reference for the field type, you might also set an additional property specific to this type.

Normally, C1 CMS sets this property to a default value but you can select a different value for it, too.

For the String type, you can also specify the string’s maximum length. You can select 16, 32, 64, 128, 256, 512 and 1024 characters for the maximum or set the string to the unlimited length. By default, the value is set to 64.

Figure 12: Additional property for the String field

For the Decimal number type, you can also set up the number of decimal places. You can choose 1, 2, 3 or 4. The default value is set to 2.

Figure 13: Additional property for the Decimal number field

For the Data references, you should select the reference type, that is, what entity you want to reference in this field. This will result in a special field that will serve as a list of these entities.

Figure 14: Additional property for the Data reference field

The data references can be of the following types:

Data Reference Types

Property

Description

C1 Image File

Image files available in the Media Archive

C1 Media File

Media files available in the Media Archive

C1 Media Folder

Folders available in the Media Archive

C1 Page

Pages created for one or more websites in C1 CMS

 

By default, the reference type is set to C1 Image.

In addition to these predefined reference types, if you have global data types, you can also select them for the reference type. In this case, the data items of this data type will be listed as entities in the field of this type.

Advanced Field Properties

A number of advanced properties allow you to fine-tune the field you add to a data type.

Figure 15: Advanced field properties

Every time you add another field, its advanced properties are set to defaults automatically. You can choose to override these default values.

Field Types

Property

Description

Widget type

A widget to serve as an input control on a form representing this data type.

Validation rules

Constraints and limitations you can apply to the data entered in this field.

Is title field

When checked, it indicates that this field will be used as the title field when listing data in views like tree structures etc.

Tree ordering

When the Order ascending (A-Z) or Order descending (Z-A) option is selected, this field will be used to sort data in lists in the order specified. Based on the number of fields in the data type, you can also select this field to Order 2 ascending or Order 2 descending and so on.

Tree grouping

When the Group by this field option is selected, this field will be used to group data in long lists, which improves their readability. Based on the number of fields in the data type, you can also select this field to Group as 2nd priority and so on.

Default value

The value, to which the field will be set by default when a new data item is added.

Field appears in Data URL

When checked, it indicates that this field will appear in Data URLs. Please see “Using Fields in Data URLs” for more information.