This module defines form-processing functions.
See the dojo/dom-form reference documentation for more information.
fieldToObject
(inputNode)
Defined by dojo/dom-form
Serialize a form field to a JavaScript object.
Returns the value encoded in a form field as as a string or an array of strings. Disabled form elements and unchecked radio and checkboxes are skipped. Multi-select elements are returned as an array of string values.
Parameter | Type | Description |
---|---|---|
inputNode | DOMNode | String |
Returns: Object | undefined
toJson
(formNode,prettyPrint)
Defined by dojo/dom-form
Create a serialized JSON string from a form node or string ID identifying the form to serialize
Parameter | Type | Description |
---|---|---|
formNode | DOMNode | String | |
prettyPrint | Boolean | Optional |
Returns: String | undefined
toObject
(formNode)
Defined by dojo/dom-form
Serialize a form node to a JavaScript object.
Returns the values encoded in an HTML form as string properties in an object which it then returns. Disabled form elements, buttons, and other non-value form elements are skipped. Multi-select elements are returned as an array of string values.
Parameter | Type | Description |
---|---|---|
formNode | DOMNode | String |
Returns: object
This form:
<form id="test_form">
<input type="text" name="blah" value="blah">
<input type="text" name="no_value" value="blah" disabled>
<input type="button" name="no_value2" value="blah">
<select type="select" multiple name="multi" size="5">
<option value="blah">blah</option>
<option value="thud" selected>thud</option>
<option value="thonk" selected>thonk</option>
</select>
</form>
yields this object structure as the result of a call to formToObject():
{
blah: "blah",
multi: [
"thud",
"thonk"
]
};
toQuery
(formNode)
Defined by dojo/dom-form
Returns a URL-encoded string representing the form passed as either a node or string ID identifying the form to serialize
Parameter | Type | Description |
---|---|---|
formNode | DOMNode | String |
Returns: String | undefined
© 2005–2017 JS Foundation
Licensed under the AFL 2.1 and BSD 3-Clause licenses.
http://dojotoolkit.org/api/1.10/dojo/dom-form.html