Event fired whenever submit button is clicked on a notification form.

"notification-form-submitted"

Hierarchy

  • NotificationFormSubmittedEvent

Properties

form: Record<string, unknown>
notification: Readonly<Object>
preventDefault: (() => void)

Type declaration

    • (): void
    • Prevents the default behaviour of notification form submit, where notification card gets dismissed right after submit.

      Example

      addEventListener('notification-form-submitted', async (event) => {
      // preventing the default submit behaviour
      event.preventDefault();

      // setting the form status to processing
      event.setFormStatus({
      formStatus: 'Processing'
      });

      const longOperationResult = await ...();

      if (longOperationResult.hasError) {
      // setting error if long-running operation has failed.
      event.setFormStatus({
      formStatus: 'not-submitted',
      error: longOperationResult.operationErrorMessage
      });
      } else {
      // setting form status to submitted
      event.setFormStatus({
      formStatus: 'submitted'
      });
      }
      });

      Returns void

setFormStatus: ((formStatusOptions: Omit<FormStatusOptions, "_notificationId">) => Promise<void>)

Type declaration

    • (formStatusOptions: Omit<FormStatusOptions, "_notificationId">): Promise<void>
    • Example

      addEventListener('notification-form-submitted', async (event) => {
      // preventing the default submit behaviour
      event.preventDefault();

      // setting the form status to processing
      event.setFormStatus({
      formStatus: 'Processing'
      });

      const longOperationResult = await ...();

      if (longOperationResult.hasError) {
      // setting error if long-running operation has failed.
      event.setFormStatus({
      formStatus: 'not-submitted',
      error: longOperationResult.operationErrorMessage
      });
      } else {
      // setting form status to submitted
      event.setFormStatus({
      formStatus: 'submitted'
      });
      }
      });

      Parameters

      • formStatusOptions: Omit<FormStatusOptions, "_notificationId">

        Allows to set the status of the form. The form status reflects the state of the submit button which includes its text. Submit button text for different statuses is defined using formOptions property for a submit button when creating a notification.

      Returns Promise<void>

type: "notification-form-submitted"

Generated using TypeDoc