The goog.dom.forms Namespace

.focusAndSelect(el)

Focuses, and optionally selects the content of, a form element.

el {Element}
The form element.

.getFormDataMap(form)

Returns form data as a map of name to value arrays. This doesn't support file inputs.

form {HTMLFormElement}
The form.
returns {!goog.structs.Map}
A map of the form data as form name to arrays of values.

.getFormDataString(form)

Returns the form data as an application/x-www-url-encoded string. This doesn't support file inputs.

form {HTMLFormElement}
The form.
returns {string}
An application/x-www-url-encoded string.

.getValue(el)

Gets the current value of any element with a type.

el {Element}
The element.
returns {string|Array.<string>|null}
The current value of the element (or null).

.getValueByName(form, name)

Returns the value of the named form field. In the case of radio buttons, returns the value of the checked button with the given name.

form {HTMLFormElement}
The form element.
name {string}
Name of an input to the form.
returns {Array.<string>|string|null}
The value of the form element, or null if the form element does not exist or has no value.

.hasFileInput(form)

Whether the form has a file input.

form {HTMLFormElement}
The form.
returns {boolean}
Whether the form has a file input.

.hasValue(el)

Whether a form element has a value.

el {Element}
The element.
returns {boolean}
Whether the form has a value.

.hasValueByName(form, name)

Whether a named form field has a value.

form {HTMLFormElement}
The form element.
name {string}
Name of an input to the form.
returns {boolean}
Whether the form has a value.

.setDisabled(el, disabled)

Enables or disables either all elements in a form or a single form element.

el {Element}
The element, either a form or an element within a form.
disabled {boolean}
Whether the element should be disabled.

.setValue(el, opt_value)

Sets the current value of any element with a type.

el {Element}
The element.
opt_value {*=}
The value to give to the element, which will be coerced by the browser in the default case using toString. This value should be an array for setting the value of select multiple elements.