CustomEditor Object

field.createCustomEditor() returns the CustomEditor object. The Field object holds field data.

Method Parameter Required Returns Usage
getFrame()

None

n/a

The iframe element with src set to the custom field editor url.

var customEditor = field.createCustomEditor(customFieldEditor);
//get custom editor's frame
var editorFrame = customEditor.getFrame();
setDisabled(disable)

Note: this function should be invoked after the custom editor is ready.

ture | false

yes

Invokes the custom field editor's disable callback function registered via registerDisable() function if such exists for the custom field editor.
customEditor.on('editorReady', function () {
  //to disable the custom field editor
  customEditor.setDisabled(true);
});
getValue()

None

n/a

Returns the value in the custom field editor.

customEditor.getValue();
validate()

None

n/a

Invokes the custom field editor's validate callback function registered via setValidation() function if such exists for the custom field editor. Returns a Promise. When fullfilled returns validation object.

// when valid
{
  isValid: true,
}
  
// when invalid
{
  isValid: false,
  errorMessageSummary: <error message>
  errorMessageDetail: <detail error message>
};
customEditor.validate().then(function (validation) {
  if (validation && validation.isValid) {
    // handle valid field value
  } else {
    //display validation error
  }
}).catch(function (error) {
  // handle error
});
resizeEditorFrame(size)

Object with height and width

yes

Resizes the frame containing the custom editor to specified size.

customEditor.resizeEditorFrame({
    width: '600px',
    height: '250px'
});
on(event, handler)

event - string

handler - function that handles the event

yes

Supported events:
  • editorReady
  • change
  • editorResized
customEditor.on('editorReady', function () {
  // if the editor needs any disabling, it can happen here
});
 
 
customEditor.on('editorResized', function (data) {
 // if any dom elements needs to be adjusted
});
 
// look for change even to grab the editor's changed value
customEditor.on('change', function (value) {
  // validate field value if necessary
  field.validate(value).then(function (validation) {
    if (validation && validation.isValid) {
      // handle valid field value
    } else {
      //display field validation error
    }
  }).catch(function (error) {
    // handle error
  });
});