Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Form

Index

Constructors

constructor

  • new Form(connection: ClientConnection, readOnly: boolean): Form
  • Parameters

    • connection: ClientConnection
    • readOnly: boolean

    Returns Form

Properties

Private connection

connection: ClientConnection

Private onChangeStack

onChangeStack: Array<onChangeHandler>

readOnly

readOnly: boolean

Methods

getValue

  • getValue<FormModel>(): Promise<Body<FormModel>>
  • Get the current model state of all the fields in the form.

    type

    FormModel is the entire parent model that will be a peer to this extension

    Example

    try {
      const value = await sdk.form.getValue();
    
      console.log(value)
    } catch (e) {
      // In a context where there is no form model
    }

    Type parameters

    • FormModel

    Returns Promise<Body<FormModel>>

onReadOnlyChange

  • Allows you to provide a callback to be executed after the readonly state changes. This method can be chained to append multiple callbacks.

    Parameters

    • cb: onChangeHandler

      Callback function that executes upon readonly state change.

    Returns Form

    Form

    Example

    const container = document.querySelector('.container');
    const inputs = Array.from(document.querySelectorAll('input'));
    
    sdk.form
     .onReadOnlyChange(setReadOnlyClass)
     .onReadOnlyChange(disableInputs)
    
    function disableInputs(readOnly)  {
      inputs.forEach(input => {
        input.style.pointerEvents = readOnly ? 'none' : ''
      })
    }
    
    function setReadOnlyClass(readOnly) {
      container.classList[readOnly ? 'add' : 'remove']('read-only')
    }

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc