core_form/submit

Submit button JavaScript. All submit buttons will be automatically disabled once the form is submitted, unless that submission results in an error/cancelling the submit.

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

Members

(static, constant) init

Source:

Initialises submit buttons.

(inner) cookieListener

Source:
Properties:
Name Type Description
ID number

for setInterval used when polling for download cookie

(inner, constant) cookieListeningButtons

Source:
Properties:
Name Type Description
Array Array

of buttons that need re-enabling if we get a download cookie

(inner) currentUploadCount

Source:
Properties:
Name Type Description
Number number

of files uploading.

(inner) uploadListenersRegistered

Source:
Properties:
Name Type Description
Is Boolean

upload listeners registered?

(inner, constant) uploadListeningButtons

Source:
Properties:
Name Type Description
Array Array

of buttons that need re-enabling if we get a upload process.

Methods

(inner) checkUploadCount()

Source:

Enable submit buttons when all files are uploaded.

(inner) clearDownloadCookie()

Source:

Clears the download cookie if there is one.

(inner) getCookieName() → {string}

Source:

Gets a unique name for the download cookie.

Returns:

Cookie name

Type
string

(inner) listenForDownloadCookie(button)

Source:

Listens in case a download cookie is provided.

This function is used to detect file downloads. If there is a file download then we get a beforeunload event, but the page is never unloaded and when the file download completes we should re-enable the buttons. We detect this by watching for a specific cookie.

PHP function \core_form\util::form_download_complete() can be used to send this cookie.

Parameters:
Name Type Description
button HTMLElement

Button to re-enable