FormData

open class FormData(form: EventTarget = definedExternally, submitter: EventTarget? = definedExternally) : MapLike<JsString, FormDataEntryValue> (source)

The FormData interface provides a way to construct a set of key/value pairs representing form fields and their values, which can be sent using the fetch(), XMLHttpRequest.send() or navigator.sendBeacon() methods. It uses the same format a form would use if the encoding type were set to "multipart/form-data".

MDN Reference

Constructors

Link copied to clipboard
constructor(form: EventTarget = definedExternally, submitter: EventTarget? = definedExternally)

Functions

Link copied to clipboard
fun append(name: String, value: String)

The append() method of the FormData interface appends a new value onto an existing key inside a FormData object, or adds the key if it does not already exist.

fun append(name: String, value: Blob)
fun append(name: String, blobValue: Blob, filename: String = definedExternally)
Link copied to clipboard
fun delete(name: String)

The delete() method of the FormData interface deletes a key and its value(s) from a FormData object.

Link copied to clipboard
Link copied to clipboard
open override fun forEach(action: (FormDataEntryValue, key: JsString) -> Unit)
Link copied to clipboard

The get() method of the FormData interface returns the first value associated with a given key from within a FormData object. If you expect multiple values and want all of them, use the getAll() method instead.

Link copied to clipboard

The getAll() method of the FormData interface returns all the values associated with a given key from within a FormData object.

Link copied to clipboard
fun has(name: String): Boolean

The has() method of the FormData interface returns whether a FormData object contains a certain key.

Link copied to clipboard
open override fun keys(): JsIterator<JsString>
Link copied to clipboard
fun set(name: String, value: String)

The set() method of the FormData interface sets a new value for an existing key inside a FormData object, or adds the key/value if it does not already exist.

fun set(name: String, value: Blob)
fun set(name: String, blobValue: Blob, filename: String = definedExternally)
Link copied to clipboard
open override fun values(): JsIterator<FormDataEntryValue>