Module org.htmlunit

Class FormData

java.lang.Object
org.htmlunit.corejs.javascript.SlotMapOwner<org.htmlunit.corejs.javascript.Scriptable>
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.Scriptable>, org.htmlunit.corejs.javascript.debug.DebuggableObject, org.htmlunit.corejs.javascript.PropHolder<org.htmlunit.corejs.javascript.Scriptable>, org.htmlunit.corejs.javascript.Scriptable, org.htmlunit.corejs.javascript.SymbolScriptable

public class FormData extends HtmlUnitScriptable
JavaScript host object for FormData.
Author:
Ahmed Ashour, Ronald Brill, Thorsten Wendelmuth
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    Iterator support for FormData.

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

    org.htmlunit.corejs.javascript.ScriptableObject.DescriptorInfo, org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator, org.htmlunit.corejs.javascript.ScriptableObject.LambdaGetterFunction, org.htmlunit.corejs.javascript.ScriptableObject.LambdaSetterFunction
  • Field Summary

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

    CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST

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

    isSealed

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

    NOT_FOUND
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    append(String name, Object value, Object filename)
    Appends a new value for an existing key, or adds the key if it does not already exist.
    void
    Removes the entry with the given name, if it exists.
    org.htmlunit.corejs.javascript.Scriptable
    Returns an iterator over all name/value pairs contained in this FormData.
    void
    fillRequest(WebRequest webRequest)
    Populates the given WebRequest with the parameters from this FormData.
    void
    forEach(Object callback)
    Iterates over all key/value pairs in this FormData, calling the given callback for each.
    get(String name)
    Returns the first value associated with the given name.
    org.htmlunit.corejs.javascript.Scriptable
    getAll(String name)
    Returns all values associated with the given name.
    boolean
    has(String name)
    Returns whether an entry with the given name exists.
    void
    Creates an instance of this object, optionally pre-populated from the given form.
    Returns an iterator over all keys in this FormData.
    void
    set(String name, Object value, Object filename)
    Sets a new value for an existing key, replacing all existing values for that key, or adds the key if it does not already exist.
    Returns an iterator over all values in this FormData.

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

    applyDescriptorToAttributeBitset, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkNotSealed, checkPropertyChangeForSlot, checkPropertyChangeForSlot, checkPropertyDefinition, checkPropertyDefinition, checkSlotRemoval, defineBuiltinProperty, defineBuiltinProperty, defineBuiltInProperty, defineBuiltInProperty, defineBuiltInProperty, defineBuiltInProperty, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureScriptableObjectButNotSymbol, ensureSymbolScriptable, ensureType, get, get, getAllIds, getAncestor, getArrayPrototype, getClassPrototype, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getSuperProperty, getSuperProperty, getSuperProperty, getThis, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, hasProperty, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGenericDescriptor, isGetterOrSetter, isGetterOrSetter, isTrue, preventExtensions, put, put, putConst, putConstProperty, putConstProperty, putOwnProperty, putOwnProperty, putOwnProperty, putProperty, putProperty, putProperty, putProperty, putSuperProperty, putSuperProperty, putSuperProperty, querySlot, redefineProperty, redefineProperty, sameValue, sealObject, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size

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

    associateValue, checkNotSealed, copyAssociatedValue, createSlotMap, defineProperty, defineProperty, get, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getIds, has, has, isSealed, readMaps, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, writeMaps

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

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

    get, getIds, has, has

    Methods inherited from interface org.htmlunit.corejs.javascript.SymbolScriptable

    get, has
  • Constructor Details

    • FormData

      public FormData()
  • Method Details

    • jsConstructor

      public void jsConstructor(Object formObj)
      Creates an instance of this object, optionally pre-populated from the given form.
      Parameters:
      formObj - an HTMLFormElement to initialize the data from, or undefined
    • append

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

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

      public String get(String name)
      Returns the first value associated with the given name.
      Parameters:
      name - the name of the field to retrieve
      Returns:
      the first value found, or null if not found
    • getAll

      public org.htmlunit.corejs.javascript.Scriptable getAll(String name)
      Returns all values associated with the given name.
      Parameters:
      name - the name of the field to retrieve
      Returns:
      an array of all values found for the given name
    • has

      public boolean has(String name)
      Returns whether an entry with the given name exists.
      Parameters:
      name - the name of the field to check
      Returns:
      true if the name exists, false otherwise
    • set

      public void set(String name, Object value, Object filename)
      Sets a new value for an existing key, replacing all existing values for that key, or adds the key if it does not already exist.
      Parameters:
      name - the name of the field
      value - the field's value
      filename - the filename reported to the server (optional)
    • entries

      public org.htmlunit.corejs.javascript.Scriptable entries()
      Returns an iterator over all name/value pairs contained in this FormData.
      Returns:
      an iterator of [name, value] arrays
    • fillRequest

      public void fillRequest(WebRequest webRequest)
      Populates the given WebRequest with the parameters from this FormData.
      Parameters:
      webRequest - the web request to fill
    • forEach

      public void forEach(Object callback)
      Iterates over all key/value pairs in this FormData, calling the given callback for each.
      Parameters:
      callback - the function to execute for each key/value pair
    • keys

      Returns an iterator over all keys in this FormData.
      Returns:
      an iterator of key strings
    • values

      public FormData.FormDataIterator values()
      Returns an iterator over all values in this FormData.
      Returns:
      an iterator of value strings