v7.3.0

Field
Abstract

Base class for TextField and NumberField. Not to be used directly.

Most subclasses can be used as editors for the Column. The most popular are:

No results

Configs

Configs are options you supply in a configuration object when creating an instance of this class
  • Specify true to auto select field contents on focus

  • Show a trigger to clear field, if this field is not readOnly. The trigger is available in the triggers object under the name clear. May also be an object which configures the cleartrigger.

  • Specify true to highlight field after external value changes

  • Text to display in empty field.

    Has a corresponding runtime placeholder property.

  • Configure as true to indicate that a null field value is to be marked as invalid. This will optionally append a * to the field label if showRequiredIndicator is set.

    Has a corresponding runtime required property.

  • If this field is not readOnly, then setting this option means that pressing the Escape key after editing the field will revert the field to the value it had when the user focused the field. If the field is not changed from when focused, the clearable behaviour will be activated.

  • true to automatically display a * after the label for this field when it is required.

    Has a corresponding runtime showRequiredIndicator property.

  • Set to true, completely bypasses validation logic (could be userful if your field is not editable to the user).

  • Default value

    Has a corresponding runtime value property.

  • The default configuration for the container.

  • attributes : String[]
    private

    A list of property names to be set in the underlying input element from properties by the same name in this Field object if the value is not == null.

  • Sets the native autocomplete property of the underlying input element. For more information, please refer to MDN

  • Text alignment for the input field.

  • Sets custom attributes of the underlying input element. For more information, please refer to MDN

  • inputTag : String
    ADVANCED

    If you need to use something else than a default input element, as the input element, provide the tag name here. Please note that this is used for advanced usage only, for example when using WebComponents (custom elements), and that the configured element must fulfil the same contract as a regular input element.

  • Sets the type attribute of the underlying input element (password, hidden, date, color, etc.).

  • The width to apply to the .b-field-inner element, which encompasses the input element and any triggers. If a number is specified, px will be used.

  • Sets the native spellcheck property of the underlying input element. For more information, please refer to MDN

  • Set to false to not highlight a field as invalid while typing, to instead show it on ENTER key press or similar.

  • The labels to add either before or after the input field. Each label may have the following properties:

    • html The label text.
    • align'start' or 'end' which end of the field the label should go.
    • html : String

      Label text

    • align : 'start'/'end'

      Which end of the file the label should go

Properties

Properties are getters/setters or publicly accessible variables on this class
  • isField : Booleantrue
    READONLY
    static
    ADVANCED
    Identifies an object as an instance of Field class, or subclass thereof.
  • The input element at the heart if this field

  • isEmptyInput : Boolean
    READONLY

    Returns true if the field's input is empty

  • isValid : Boolean
    READONLY

    Returns true if the field value is valid

  • Text to display in empty field.

    Has a corresponding placeholder config.

  • Configure as true to indicate that a null field value is to be marked as invalid. This will optionally append a * to the field label if showRequiredIndicator is set.

    Has a corresponding required config.

  • true to automatically display a * after the label for this field when it is required.

    Has a corresponding showRequiredIndicator config.

  • validity : ValidityState
    private
    READONLY

    Returns the DOM ValidityState for this widget's input element, or null if there isn't one.

  • isField : Booleantrue
    READONLY
    ADVANCED
    Identifies an object as an instance of Field class, or subclass thereof.

Functions

Functions are methods available for calling on the class
    • clear( )
      ASYNC

      Clears the value of this Field, and triggers the clear event.

    • internalOnChange( )
      private

      Trigger event when fields input changes


      Triggers: change

    • onDisabled( )
      private

      Called when disabled state is changed. Used to add or remove 'b-invalid' class for the invalid field based on current disabled state.

    • onEditComplete( )
      internal

      Template function which may be implemented by subclasses to synchronize input state and validity state upon completion of the edit.

    Events

    Events are triggered for certain actions in this class and can be listened for to react to those actions in your code

    Event handlers

    Event handlers are callbacks called as a result of certain actions in this class

    Type definitions

    CSS variables

    CSS variables that can be set to adjust appearance
    Name Description
    --b-field-default-label-padding Padding for label, for the default label position
    --b-field-default-template-areas Template areas for the fields grid layout, for the default label position
    --b-field-default-template-columns Template columns for the fields grid layout, for the default label position
    --b-field-default-template-rows Template rows for the fields grid layout, for the default label position
    --b-field-error-tip-background Background for tip shown for invalid fields
    --b-field-error-tip-color Text color for tip shown for invalid fields
    --b-field-error-tip-primary Primary color for tip shown for invalid fields
    --b-field-label-above-gap Gap between label and field, for label above the field
    --b-field-label-above-padding Padding for label shown above the field
    --b-field-label-before-gap Gap between label and field, for label before the field
    --b-field-label-before-padding Padding for label shown before the field
    --b-field-label-default-gap Gap between label and field, for the default label position
    --b-field-label-padding Label padding

    Source path

    Core/widget/Field.js

    Contents