Field

Field

Class representing a field from Contentstack UI. Only available for Custom Field extension

Members

data_type :string

Source:
The data type of the current field is set using this method.
Type:
  • string

schema :Object

Source:
The schema of the current field (schema of fields such as ‘Single Line Textbox’, ‘Number’, and so on) is set using this method.
Type:
  • Object

uid :string

Source:
The UID of the current field is defined in the content type of the entry.
Type:
  • string

Methods

getData(options) → {Object|string|number}

Source:
Gets the data of the current field
Parameters:
Name Type Description
options Object Options object for get Data method.
Properties
Name Type Description
resolved boolean If the resolved parameter is set to true for the File field, then the method will return a resolved asset object along with all the field metadata, e.g. 'field.getData({resolved:true})'.
Returns:
Returns the field data.
Type
Object | string | number

setData(data) → {external:Promise}

Source:
Sets the data for the current field.
Parameters:
Name Type Description
data Object | string | number Data to be set on the field
Returns:
A promise object which is resolved when data is set for a field. Note: The data set by this function will only be saved when user saves the entry.
Type
external:Promise

setFocus() → {Object}

Source:
Sets the focus for a field when an extension is being used. This method shows user presence and highlights the extension field that the user is currently accessing in Contentstack UI.
Returns:
A promise object which is resolved when Contentstack UI returns an acknowledgement of the focused state.
Type
Object