core_form/events

Javascript events for the core_form subsystem.

Source:
Since:
  • 3.10
License:
  • http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
Example

Example of listening to a form event.

import {eventTypes as formEventTypes} from 'core_form/events';

document.addEventListener(formEventTypes.formSubmittedByJavascript, e => {
    window.console.log(e.target); // The form that was submitted.
    window.console.log(e.detail.skipValidation); // Whether form validation was skipped.
});

Members

(static, constant) eventTypes

Source:
Properties:
Name Type Description
formError String

See event:core_form/error

formFieldValidationFailed String

See event:core_form/fieldValidationFailed

formSubmittedByJavascript String

See event:core_form/submittedByJavascript

uploadChanged String

See event:core_form/uploadChanged

Events for core_form.

(static, constant) types

Source:
Deprecated:

List of the events.

Methods

(static) notifyFormSubmittedByJavascript(form, skipValidation, fallbackHandled) → {CustomEvent}

Source:

Trigger an event to indiciate that a form was submitted by Javascript.

Parameters:
Name Type Description
form HTMLElement

The form that was submitted

skipValidation Boolean

Submit the form without validation. E.g. "Cancel".

fallbackHandled Boolean

The legacy YUI event has been handled

Fires:
  • event:formSubmittedByJavascript
Returns:
Type
CustomEvent

(static) notifyUploadChanged(elementId) → {CustomEvent}

Source:

Trigger an event to notify the file upload field has been changed.

Parameters:
Name Type Description
elementId string

The element which was changed

Fires:
  • event:uploadChanged
Returns:
Type
CustomEvent

(static) notifyUploadCompleted(elementId) → {CustomEvent}

Source:

Trigger an event to indicate that an upload was completed.

Parameters:
Name Type Description
elementId String

The element which was uploaded to

Fires:
  • event:uploadCompleted
Returns:
Type
CustomEvent

(static) notifyUploadStarted(elementId) → {CustomEvent}

Source:

Trigger an event to indicate that an upload was started.

Parameters:
Name Type Description
elementId String

The element which was uploaded to

Fires:
  • event:uploadStarted
Returns:
Type
CustomEvent

(static) triggerUploadCompleted(elementId) → {CustomEvent}

Source:
Deprecated:

Trigger upload complete event.

Parameters:
Name Type Description
elementId String
Fires:
  • event:uploadCompleted
Returns:
Type
CustomEvent

(static) triggerUploadStarted(elementId) → {CustomEvent}

Source:
Deprecated:

Trigger upload start event.

Parameters:
Name Type Description
elementId String
Fires:
  • event:uploadStarted
Returns:
Type
CustomEvent

(inner) changesMadeCheck(e)

Source:

Prevent user navigate away when upload progress still running.

Parameters:
Name Type Description
e Event

The event

(inner) notifyFieldValidationFailure(field, message) → {CustomEvent}

Source:

Trigger an event to indicate that a form field contained an error.

Parameters:
Name Type Description
field HTMLElement

The field which failed validation

message String

The message displayed

Fires:
  • event:formFieldValidationFailed
Returns:
Type
CustomEvent

(inner) notifyFormError(field) → {CustomEvent}

Source:

Trigger an event to indicate that a form field contained an error.

Parameters:
Name Type Description
field HTMLElement

The form field causing the error

Fires:
Returns:
Type
CustomEvent

Events

core_form/fieldValidationFailed

Source:
Properties:
Name Type Description
target HTMLElement

The field that failed validation

detail object
Properties
Name Type Description
message String

The message displayed upon failure

An event triggered upon form field validation failure.

Type:
  • CustomEvent

core_form/submittedByJavascript

Source:
Properties:
Name Type Description
target HTMLElement

The form that was submitted

detail object
Properties
Name Type Description
skipValidation boolean

Whether the form was submitted without validation (i.e. via a Cancel button)

fallbackHandled boolean

Whether the legacy YUI event has been handled

An event triggered when an mform is about to be submitted via javascript.

Type:
  • CustomEvent

core_form/uploadChanged

Source:
Properties:
Name Type Description
target HTMLElement

The form field which was changed

An event triggered when a file upload field has been changed.

Type:
  • CustomEvent

core_form/uploadCompleted

Source:
Properties:
Name Type Description
target HTMLElement

The location where the upload completed

An event triggered when an upload completes

Type:
  • CustomEvent

core_form/uploadStarted

Source:
Properties:
Name Type Description
target HTMLElement

The location where the upload began

An event triggered when an upload is started

Type:
  • CustomEvent

formError

Source:
Properties:
Name Type Description
target HTMLElement

The form field which errored

An event triggered when a form contains an error

Type:
  • CustomEvent