Class FormData

java.lang.Object
org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.javascript.HtmlUnitScriptable
org.htmlunit.javascript.host.xml.FormData
All Implemented Interfaces:
Serializable, Cloneable, org.htmlunit.corejs.javascript.ConstProperties, org.htmlunit.corejs.javascript.debug.DebuggableObject, org.htmlunit.corejs.javascript.Scriptable, org.htmlunit.corejs.javascript.SymbolScriptable

public class FormData extends HtmlUnitScriptable
A JavaScript object for FormData.
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
     

    Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject

    org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Constant used to register the prototype in the context.
    private final List<NameValuePair>
     

    Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject

    CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST

    Fields inherited from interface org.htmlunit.corejs.javascript.Scriptable

    NOT_FOUND
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    append(String name, Object value, Object filename)
    Appends a new value onto an existing key inside a FormData object, or adds the key if it does not already exist.
    void
    Removes the entry (if exists).
    org.htmlunit.corejs.javascript.Scriptable
     
    void
    fillRequest(WebRequest webRequest)
    Sets the specified request with the parameters in this FormData.
    void
    forEach(Object callback)
    The FormData.forEach() method allows iteration through all key/value pairs contained in this object via a callback function.
    get(String name)
     
    org.htmlunit.corejs.javascript.Scriptable
    getAll(String name)
     
    boolean
    has(String name)
     
    void
    Constructor.
    The FormData.keys() method returns an iterator allowing to go through all keys contained in this object.
    void
    set(String name, Object value, Object filename)
    Sets a new value for an existing key inside a FormData object, or adds the key if it does not already exist.
    The URLSearchParams.values() method returns an iterator allowing to go through all values contained in this object.

    Methods inherited from class org.htmlunit.corejs.javascript.ScriptableObject

    applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, get, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setPrototype, size

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • FORM_DATA_TAG

      public static final String FORM_DATA_TAG
      Constant used to register the prototype in the context.
      See Also:
    • requestParameters_

      private final List<NameValuePair> requestParameters_
  • Constructor Details

    • FormData

      public FormData()
      Default constructor.
  • Method Details

    • jsConstructor

      public void jsConstructor(Object formObj)
      Constructor.
      Parameters:
      formObj - a form
    • append

      public void append(String name, Object value, Object filename)
      Appends a new value onto an existing key inside a FormData object, or adds the key if it does not already exist.
      Parameters:
      name - the name of the field whose data is contained in value
      value - the field's value
      filename - the filename reported to the server (optional)
    • delete_js

      public void delete_js(String name)
      Removes the entry (if exists).
      Parameters:
      name - the name of the field to remove
    • get

      public String get(String name)
      Parameters:
      name - the name of the field to check
      Returns:
      the first value found for the give name
    • getAll

      public org.htmlunit.corejs.javascript.Scriptable getAll(String name)
      Parameters:
      name - the name of the field to check
      Returns:
      the values found for the give name
    • has

      public boolean has(String name)
      Parameters:
      name - the name of the field to check
      Returns:
      true if the name exists
    • set

      public void set(String name, Object value, Object filename)
      Sets a new value for an existing key inside a FormData object, or adds the key if it does not already exist.
      Parameters:
      name - the name of the field whose data is contained in value
      value - the field's value
      filename - the filename reported to the server (optional)
    • entries

      public org.htmlunit.corejs.javascript.Scriptable entries()
      Returns:
      An Iterator that contains all the requestParameters name[0] and value[1]
    • fillRequest

      public void fillRequest(WebRequest webRequest)
      Sets the specified request with the parameters in this FormData.
      Parameters:
      webRequest - the web request to fill
    • forEach

      public void forEach(Object callback)
      The FormData.forEach() method allows iteration through all key/value pairs contained in this object via a callback function.
      Parameters:
      callback - Function to execute on each key/value pairs
    • keys

      public Object keys()
      The FormData.keys() method returns an iterator allowing to go through all keys contained in this object. The keys are USVString objects.
      Returns:
      an iterator.
    • values

      public Object values()
      The URLSearchParams.values() method returns an iterator allowing to go through all values contained in this object. The values are USVString objects.
      Returns:
      an iterator.