home / docs / sections_fts

Menu

sections_fts: 99

This data as json

rowid title content
99 The field helper object The field object passed to render(field) , focus(field) and destroy(field) provides stable IDs, DOM elements and value helpers for integrating with the row insert/edit dialog: context - object The original context object passed to makeColumnField() . id - string The ID Datasette assigned to field.input , the backing <input> or <textarea> element. labelId - string The ID of the visible field label. descriptionId - string The ID of the field metadata/help text. This metadata can include details such as Primary key , Required , Current value: NULL or Custom type: file . root - HTMLElement The empty <div> container created by Datasette for this custom field. It is inside the control area for the field in the row insert/edit dialog, next to the field label and above the field metadata. Datasette appends the DOM node returned by render(field) to this element. Plugins can alternatively manipulate this element directly and return nothing from render(field) . input - HTMLInputElement or HTMLTextAreaElement The core-owned backing form control. Plugins can keep this visible, wrap it or hide it, but should use the value helper methods below rather than mutating input.value directly. control An alias for input . meta - HTMLElement or null The field metadata/help text element. form - HTMLFormElement or null The containing row insert/edit form. dialog - HTMLDialogElement or null The containing modal dialog. getValue() - function Returns the current value for this field. Datasette uses string values by default. Insert fields for "INTEGER" and "REAL" SQLite columns return numbers, or null if left blank. Plugins can use strings, numbers, booleans or null . If a plugin is editing structured data stored in a SQLite TEXT column, such as JSON, it should serialize that data to a string before calling setValue() . setValue(value) - function Sets the current value for this field. value should be a string, number, boolean or null . Calling setValue() also stops using the SQLite default for the field, if it was previously selected. getInitialValue() - function Returns the submitted-value representation the field had when the form was rendered. For edit forms this is the raw row value from the database. For insert forms this is the blank starting value. hasChanged() - function Returns true if the field has changed since Datasette last considered it unmodified. By default that means the field state when the insert/edit form was rendered. clearValue() - function Sets the value to null . markClean() - function Tells Datasette to treat the field's current state as unmodified. After calling this method, hasChanged() returns false until the field value changes again or its SQLite-default state changes. This is useful when a plugin rewrites the starting value into an equivalent representation while initializing its editor. For example, a rich text editor might normalize empty HTML or reserialize its initial document before the user has made any edits. isUsingSqliteDefault() - function Returns true if the insert dialog is currently set to omit this column and use the SQLite default. setValidity(message) - function Sets a custom validation message for this field, marks the backing input with aria-invalid="true" and shows the message in the field metadata area. Pass an empty string to clear the error. clearValidity() - function Clears any custom validation message previously set by setValidity() .
Powered by Datasette · Queries took 3.362ms