Plugin form support

Forms are defined through your plugin.

Interface

function form(formId, pathname)

Declare a form for use by this plugin, returning a FormDescription object.

The specification is stored in a JSON file bundled in your plugin’s file/form directory, and is lazily loaded when it’s required. The formId argument must match the formId property in the specification.

See using forms for an example.

form() can only be called while the plugin is being loaded.

Consider using replaceableForm() if you are writing a generic plugin which might need custom forms for an application.

function form(specification)

Declare a form for use by this plugin, returning a FormDescription object.

The specification is passed in as a JavaScript literal object. Using this version of the form() method is not recommended as it uses memory unnecessarily, and clutters your JavaScript with form definitions.

form() can only be called while the plugin is being loaded.

function replaceableForm(formId, pathname)

Similar to form(), but the FormDescription object returned is marked as replaceable.

See Replaceable forms for how to implement a plugin which replaces a form in another plugin.

function dataSource(name, kind, definition)

Define a data source. See Data sources for the various ways data sources can be defined.

dataSource() can only be called while the plugin is being loaded.

function globalFormsCustomValidationFunction(name, fn)

Register a global custom validation function for form custom validation.

As this function name will apply to all forms, the name must be namespaced and carefully named, eg "example:specific-name-of-validation".