This module defines form-processing functions.
See the dojo/dom-form reference documentation for more information.
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 |
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
|
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 |
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" ] };
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 |