Module: FormSerialization

Get successful control from form and assemble into object

Source:
See:

Methods

(static) deserialize(form, hash) → {void}

Parameters:
Name Type Description
form HTMLFormElement
hash PlainObject
Source:
Returns:
Type
void

(static) serialize(form, options) → {*|string|PlainObject}

Serializes form fields.

Parameters:
Name Type Description
form HTMLFormElement

MUST be an HTMLFormElement

options module:FormSerialization.Options

is an optional argument to configure the serialization.

Source:
Returns:

Default output with no options specified is a url encoded string

Type
* | string | PlainObject

(inner) hashAssign(result, keys, value) → {string|PlainObject|Array}

Parameters:
Name Type Description
result PlainObject | Array
keys Array.<string>
value string
Source:
Returns:
Type
string | PlainObject | Array

(inner) hashSerializer(result, key, value) → {PlainObject}

Object/hash encoding serializer.

Parameters:
Name Type Description
result PlainObject
key string
value string
Source:
Returns:
Type
PlainObject

(inner) parseKeys(string) → {Array.<string>}

Parameters:
Name Type Description
string string
Source:
Returns:
Type
Array.<string>

(inner) strSerialize(result, key, value) → {string}

URL form encoding serializer.

Parameters:
Name Type Description
result string
key string
value string
Source:
Returns:

New result

Type
string

Type Definitions

Options

Type:
  • PlainObject
Properties:
Name Type Attributes Description
hash boolean <optional>

Configure the output type. If true, the output will be a JavaScript object.

serializer module:FormSerialization.Serializer <optional>

Optional serializer function to override the default one. Otherwise, hash and URL-encoded string serializers are provided with this module, depending on the setting of hash.

disabled boolean <optional>

If true serialize disabled fields.

empty boolean <optional>

If true serialize empty fields

Source:

Serializer(result, key, value) → {PlainObject|string|*}

Parameters:
Name Type Description
result PlainObject | string | *
key string
value string
Source:
Returns:

New result

Type
PlainObject | string | *