pub struct FormData(/* private fields */);
Expand description
The FormData
interface provides 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. It uses the same format a form would use if the encoding type
were set to "multipart/form-data"
.
Implementations§
Source§impl FormData
impl FormData
Sourcepub fn from_element<T>(form: &T) -> Result<Self, FormDataFromElementError>where
T: IElement,
pub fn from_element<T>(form: &T) -> Result<Self, FormDataFromElementError>where
T: IElement,
Creates a new FormData
from a form element.
Sourcepub fn append_string(&self, name: &str, value: &str)
pub fn append_string(&self, name: &str, value: &str)
Appends a new value onto an existing key, or adds the key if it does not already exist.
Sourcepub fn append_blob<T>(&self, name: &str, value: &T, filename: Option<&str>)where
T: IBlob,
pub fn append_blob<T>(&self, name: &str, value: &T, filename: Option<&str>)where
T: IBlob,
Appends a new blob onto an existing key, or adds the key if it does not already exist.
Sourcepub fn get(&self, name: &str) -> Option<FormDataEntry>
pub fn get(&self, name: &str) -> Option<FormDataEntry>
Deletes a key and its value(s).
Sourcepub fn get_all(&self, name: &str) -> Vec<FormDataEntry>
pub fn get_all(&self, name: &str) -> Vec<FormDataEntry>
Returns all the values associated with a given key.
Sourcepub fn has(&self, name: &str) -> bool
pub fn has(&self, name: &str) -> bool
Returns a boolean stating whether a FormData
object contains a certain key.
Sourcepub fn set_string(&self, name: &str, value: &str)
pub fn set_string(&self, name: &str, value: &str)
Sets a new value for an existing key, or adds the key/value if it does not already exist.