Date and Time custom field

Static content types

Static content types come out of the box with Sitefinity CMS, such as Pages, Blogs, News, and so on.

To add a custom field to a content item, perform the following:

  1. Perform procedure Create custom fields » Step 1 to Step 5.
  2. In the Type dropdown box, select Date and Time.
  3. Enter a name for the field.
    The name of the field is different from its label. The field's name serves as a reference for that field in the backend.
  4. If you select the This is a hidden field checkbox, the custom field is not visible on the website or in the backend, and you can only use it in the code.
    You can later unhide the field by clicking it in the Custom fields section and changing the selection on the Appearance tab.
  5. In the Interface widget for entering data dropdown box, you select the widget which the creator or editor of the content item or page will use to complete the field.
    The default widget is the Date picker. It displays date and time pickers with labels and instructions, enabling site visitors to pick up the correct date and time values easily.
  6. Expand the Advanced section if you want to change the database and the SQL database type of the custom field if you want to specify the name of the column of the database table where the custom field is added, and whether the custom field is to be included in the database index.
    If you select the Allow empty values checkbox, the field is not required and can be left empty. If you deselect it, the field becomes mandatory.
  7. Click Continue.
    A window appears where you must configure the appearance of the custom field, such as labels and instructions.

Label and texts

On this tab, perform the following:

  1. In the Label input field, enter the label of the textbox.
    For example, enter Timestamp.
  2. If needed, in Instructional text, enter instructions or explanatory text for the textbox.
    The text is displayed when the content editor clicks the question mark icon in the backend when editing the item containing this custom field.
  3. If required, in Predefined value, enter a predefined value for the textbox that is displayed in the box by default and the user can change it.
  4. If you want to make the textbox mandatory, select the Make required checkbox.
    A textbox appears where you enter the error message displayed if the user does not fill out the textbox.
  5. If you have a multilingual site, you can select or deselect Make localizable.
    This allows you to translate the field into different language versions.
    By default, the checkbox is not selected.

Appearance

On this tab, perform the following:

  1. If you do not want to display the custom field on all screens where you work with the content item, you can select the checkboxes of only those screens where you want the field to be displayed. To do this, select Some screens where you work with <content type> in the Backend… and select the screens where you want the custom field to appear.

    NOTE: When you add a custom field to Images, Videos, or Document, this field is displayed on the upload screen when you upload items via the Image widget, Video widget, or Document link widget widgets. If you do not want to display the custom fields, deselect the upload screens.

  2. If you have made the field a hidden field, the radio button Nowhere. This is a hidden field is selected when you open the field for editing. If you change the selection, the field is no longer hidden.
    If the field is not hidden, you can hide it by selecting Nowhere. This is a hidden field radio button.
  3. In the CSS class input field, you can choose a class name for the custom field if later you want to set a CSS style for this particular field.

When finished, click Done.
The new field appears in the list of custom fields for the respective module.
If you want to delete a custom field, click .

Save your changes.

Dynamic content types

Dynamic content types are the ones you create using the Module Builder.

To add a custom field to a content item, perform the following:

  1. Perform procedure Create custom fields » Step 1 to Step 5.
  2. In the Type dropdown box, select Date and Time.
  3. Enter a name for the field.
    The name of the field is different from its label. The field's name serves as a reference for that field in the backend.
  4. If you select This is a hidden field checkbox, the custom field is not visible on the website or in the backend, and you can only use it in the code.
    IMPORTANT: Once you create a hidden field, you cannot edit its properties. Make sure you have configured all its properties before finishing creating it.
  5. In the Interface widget for entering data dropdown box, you select the widget which the creator or editor of the content item or page will use to complete the field.
    The default widget is the Date picker. It displays date and time pickers with labels and instructions, enabling site visitors to pick up the correct date and time values easily.
  6. Expand the Advanced section if you want to change the database and the SQL database type of the custom field or if you want to specify the name of the column of the database table where the custom field is added.
    If you select the Allow empty values checkbox, the field is not required and can be left empty. If you deselect it, the field becomes mandatory.
  7. Click Continue.
    A window appears where you must configure the appearance of the custom field, such as labels and instructions.

General

On this tab, perform the following:

  1. In the Label input field, enter the label of the textbox.
    For example, enter Timestamp.
  2. If needed, in Instructional text, enter instructions or explanatory text for the textbox.
    The text is displayed when the content editor clicks the question mark icon in the backend when editing the item containing this custom field.
  3. If you want to make the textbox mandatory, select This is a required field.
    A textbox appears where you enter the error message displayed if the user does not fill out the textbox.
  4. If you have a multilingual site, select or deselect More options » Make localizable.
    This allows you to translate the field into different language versions.
    By default, the checkbox is not selected.

Limitations

On this tab, you can limit the interval of dates which is acceptable as user input. To do so, enter the appropriate values in Start date and End date under Time range allowed. If you set such limits, the date picker restricts your site visitors to enter only dates in the range you have specified.

When finished, click Done.
The new field appears in the list of custom fields for the respective module.
If you want to delete a custom field, click .

Save your changes.

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?

Next article

Number custom field