Get successful control from form and assemble into object
Methods
(static) deserialize(form, hash) → {void}
Parameters:
Name | Type | Description |
---|---|---|
form |
HTMLFormElement | |
hash |
PlainObject |
Returns:
- Type
- void
(static) serialize(form, options) → {*|string|PlainObject}
Serializes form fields.
Parameters:
Name | Type | Description |
---|---|---|
form |
HTMLFormElement | MUST be an |
options |
module:FormSerialization.Options | is an optional argument to configure the serialization. |
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 |
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 |
Returns:
- Type
- PlainObject
(inner) parseKeys(string) → {Array.<string>}
Parameters:
Name | Type | Description |
---|---|---|
string |
string |
Returns:
- Type
- Array.<string>
(inner) strSerialize(result, key, value) → {string}
URL form encoding serializer.
Parameters:
Name | Type | Description |
---|---|---|
result |
string | |
key |
string | |
value |
string |
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 |
disabled |
boolean |
<optional> |
If true serialize disabled fields. |
empty |
boolean |
<optional> |
If true serialize empty fields |
Serializer(result, key, value) → {PlainObject|string|*}
Parameters:
Name | Type | Description |
---|---|---|
result |
PlainObject | string | * | |
key |
string | |
value |
string |
Returns:
New result
- Type
- PlainObject | string | *