FormDescription interface

A JavaScript object implementing the FormDescription interface describes a form, which can be used to create a FormInstance object to implement a form.

Construction

Use the form() method on your plugin object.

Interface

property formId

ID of the form, as in the specification.

property formTitle

Title of the form from the specification formTitle, with NAME() text translation.

property formTitleShort

Title of the form from the specification formTitleShort, with NAME() text translation.

If the form specification doesn’t have a formTitleShort property, the formTitle will be used instead.

property specification

The form specification, lazily loaded when specified with a plugin JSON file.

function instance(document)

Returns a FormInstance object for using the form with the given document.

document is a JSON compatible data structure which contains the data manipulated by the form. Use {} if you want to create a blank form.

function handle(document, request)

This is a ‘shortcut’ method which creates a FormInstance object with the given document, calls the update() function with the given request, and return the form instance object.

Check the complete property on the instance to see if the form was submitted and valid before taking action.

Within a request handler, use E.request as the request argument.