Options
All
  • Public
  • Public/Protected
  • All
Menu

Module on

JMap.Event.Form.on

Here you have all available high level events on which you can attach a listener.

Index

Functions

beforeSubmit

  • beforeSubmit(listenerId: string, fn: function): void
  • JMap.Event.Form.on.beforeSubmit

    This event is triggered each time a form (or subform) is submitted, just before the data are submitted server side.

    example
    
    JMap.Event.Form.on.beforeSubmit(
      "custom-form-before-submit",
      params => {
       const {
         layerId,
         formId,
         isAttributeForm,
         isExternalForm,
         isSubForm,
         isCreation,
         getFormData,
         setFormData,
         getGeometry,
         setGeometry
       } = params
       console.info(`Form id=${formId} will be submit`)
       if (isAttributeForm && isCreation) {
         const geometry = getGeometry()
         const attributeByValue = getFormData()
         ... do your stuffs here
         // you can change the geometry and/or the data with setGeometry and setFormData
         // this methods don't throws if the parameters are incorrect, but form submition will fail
       } else {
         // in this case, not an attribute form creation, get and set geometry methods are undefined,
         // because we don't need them in this context.
         // But get and set FormData methods are always defined, in all cases
       }
       // You can return a Promise here and and NG will wait for
       // that promise to resolve before submitting the form
      }
    )

    Parameters

    Returns void

layerDialogClosed

  • layerDialogClosed(listenerId: string, fn: function): void
  • JMap.Event.Form.on.layerDialogClosed

    This event is triggered each time a layer form dialog is closed (attribute and external forms).

    example
    
    // log a message in the console once a form layer dialog has been closed
    JMap.Event.Form.on.layerDialogClosed(
      "custom-form-layer-dialog-closed",
      params => console.info(`Layer form dialog closed for layer id="${params.layerId}"`)
    )

    Parameters

    • listenerId: string

      Your listener id (must be unique)

    • fn: function

      Your listener function

        • (): void
        • Returns void

    Returns void

layerDialogOpened

  • layerDialogOpened(listenerId: string, fn: function): void
  • JMap.Event.Form.on.layerDialogOpened

    This event is triggered each time a layer form dialog is opened (attribute and external forms).

    example
    
    // log a message in the console once a form layer dialog has been opened
    JMap.Event.Form.on.layerDialogOpened(
      "custom-form-layer-dialog-opened",
      params => console.info(
        `Layer form dialog opened for layer id="${params.layerId}"`,
        params.attributeForm,
        params.externalForms
      )
    )

    Parameters

    Returns void

subFormDialogClosed

  • subFormDialogClosed(listenerId: string, fn: function): void
  • JMap.Event.Form.on.subFormDialogClosed

    This event is triggered each time a sub form dialog is opened.

    example
    
    // log a message in the console once a sub form dialog has been closed
    JMap.Event.Form.on.subFormDialogClosed(
      "custom-sub-form-dialog-closed",
      params => console.info(`Form dialog closed for layer id="${params.layerId}"`)
    )

    Parameters

    • listenerId: string

      Your listener id (must be unique)

    • fn: function

      Your listener function

        • (): void
        • Returns void

    Returns void

subFormDialogOpened

  • subFormDialogOpened(listenerId: string, fn: function): void
  • JMap.Event.Form.on.subFormDialogOpened

    This event is triggered each time a sub form dialog is opened.

    example
    
    // log a message in the console once a sub form dialog has been opened
    JMap.Event.Form.on.subFormDialogOpened(
      "custom-sub-form-dialog-opened",
      params => console.info(`Sub form dialog opened for layer id="${params.layerId}"`, params.subForm)
    )

    Parameters

    Returns void

submit

  • submit(listenerId: string, fn: function): void
  • JMap.Event.Form.on.submit

    This event is triggered each time a form (or subform) is submitted.

    example
    
    // log a message in the console once a form has been submitted
    JMap.Event.Form.on.submit(
      "custom-form-submit",
      params => console.info(`A form has been submitted`, params)
    )

    Parameters

    Returns void