Try our conversational search powered by Generative AI!

Loading...
ARCHIVED This content is retired and no longer maintained. See the latest version here.

Recommended reading 

Working with meta field controls

Introduction

Meta field controls are rendered for custom fields. You can see examples of them when you edit an entry or catalog nodes in the Catalog Management subsystem (legacy). This document explains how to extend and customize meta field controls.

How it works

Meta fields are rendered using default, out-of-the box controls which are defined in the "Admin/Apps/Core/MetaData/Controls/" folder. For example, the string meta field is rendered using ShortStringControl.ascx.

You may have more specific data entry constraints than the default controls provided. For example you want to add a custom status text field, and you want to ensure that only specific possible values can be entered in that field. You want to keep that field a simple string field (to improve performance) in the database, but also do not want users entering data to add invalid data.

The simplest way to do this is to:

  1. Create a new custom user control (make a copy of ShortStringControl.ascx).
  2. Change the textbox to a drop-down control with hard coded values.
  3. Make the system auto-pick-up your control instead of the default one. To do that, the name of the control must match the name and meta data type of the meta field you are mapping the control to. See table and description below.

Another example is when you want to override all fields called "ImplementationStatus" with a meta data field type of ShortString.

This can be done as follows:

  1. Name the control "ImplementationStatus.ShortStringControl.ascx".
  2. Create the meta field ImplementationStatus as a Short String in the Catalog portion of the Administration tab.
  3. Add the field to a meta class.
  4. Now, when you edit an entry in the catalog with this meta class (containing the ImplementationStatus field), the field will be represented with your custom control.

When using custom meta fields (for instance "year") with search filters in places like the "Shopping Options" sidebar control, it is recommended to use the "Float" type instead of "Decimal."

The engine allows you to override how the meta field is rendered for the scopes listed below. The position reflects the order engine validating the controls, if the control exists. This is used to render the field and evaluation stops.

Scope Control name
 Specific meta field name in particular meta class MetaClassName.MetaFieldName.TypeName.ascx
 Specific meta field name for all meta classes MetaFieldName.TypeName.ascx
 Specific meta class MetaClassName.TypeName.ascx
 Default  TypeName.ascx
Do you find this information helpful? Please log in to provide feedback.

Last updated: May 28, 2015

Recommended reading