AboutSupportDeveloper GuideVersion 17.0.15

Interface NotificationFormSubmittedEvent

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.

      Returns 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'
      });
      }
      });
setFormStatus: ((formStatusOptions) => Promise<void>)

Type declaration

    • (formStatusOptions): Promise<void>
    • 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>

      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'
      });
      }
      });
type: "notification-form-submitted"