FormData

@native @JSGlobal @JSType
class FormData extends Iterable[Tuple2[String, String | Blob]]

XMLHttpRequest Level 2 adds support for the new FormData interface. FormData objects provide a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest send() method.

Companion:
object
trait Iterable[Tuple2[String, String | Blob]]
class Object
trait Any
class Object
trait Matchable
class Any

Value members

Constructors

def this(form: HTMLFormElement, submitter: HTMLElement)

Concrete methods

def append(name: String, value: String): Unit

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.

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.

Value parameters:
name

The name of the field whose data is contained in value.

value

The field's value. This can be a string or Blob (including subclasses such as File). If none of these are specified the value is converted to a string.

def append(name: String, value: Blob, blobName: String): Unit

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.

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.

Value parameters:
blobName

The filename reported to the server (a string), when a Blob or File is passed as the second parameter. The default filename for Blob objects is "blob". The default filename for File objects is the file's filename.

name

The name of the field whose data is contained in value.

value

The field's value. This can be a string or Blob (including subclasses such as File). If none of these are specified the value is converted to a string.

def delete(name: String): Unit

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

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

Value parameters:
name

The name of the key you want to delete.

def entries(): Iterator[Tuple2[String, String | Blob]]

The FormData.entries() method returns an iterator which iterates through all key/value pairs contained in the FormData. The key of each pair is a string object, and the value is either a string or a Blob.

The FormData.entries() method returns an iterator which iterates through all key/value pairs contained in the FormData. The key of each pair is a string object, and the value is either a string or a Blob.

def get(name: String): String | Blob

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.

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.

Value parameters:
name

A string representing the name of the key you want to retrieve.

Returns:

A value whose key matches the specified name. Otherwise, null.

def getAll(name: String): Array[String | Blob]

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

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

def has(name: String): Boolean

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

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

Value parameters:
name

A string representing the name of the key you want to test for.

Returns:

true if a key of FormData matches the specified name. Otherwise, false.

@JSName
override def jsIterator(): Iterator[Tuple2[String, String | Blob]]
Definition Classes
Iterable
def keys(): Iterator[String]

The FormData.keys() method returns an iterator which iterates through all keys contained in the FormData. The keys are strings.

The FormData.keys() method returns an iterator which iterates through all keys contained in the FormData. The keys are strings.

def set(name: String, value: String): Unit

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.

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.

Value parameters:
name

The name of the field whose data is contained in value.

value

The field's value.

def set(name: String, value: Blob, blobName: String): Unit

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.

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.

Value parameters:
name

The name of the field whose data is contained in value.

value

The field's value.

def values(): Iterator[String | Blob]

The FormData.values() method returns an iterator which iterates through all values contained in the FormData. The values are strings or Blob objects.

The FormData.values() method returns an iterator which iterates through all values contained in the FormData. The values are strings or Blob objects.

Inherited methods

def hasOwnProperty(v: String): Boolean
Inherited from:
Object
def isPrototypeOf(v: Object): Boolean
Inherited from:
Object
def propertyIsEnumerable(v: String): Boolean
Inherited from:
Object
def toLocaleString(): String
Inherited from:
Object
def valueOf(): Any
Inherited from:
Object