forms.js
No description.

File Location

/goog/dom/forms.js


Public Protected Private

Global Functions

goog.dom.forms.addFormDataToMap_(mapnamevalue)
Adds the name/value pair to the map.
Arguments:
map : goog.structs.Map
The map to add to.
name : string
The name.
value : string
The value.
code »
goog.dom.forms.addFormDataToStringBuffer_(sbnamevalue)
Adds a name/value pair to an string buffer array in the form 'name=value'.
Arguments:
sb : Array
The string buffer array for storing data.
name : string
The name.
value : string
The value.
code »
goog.dom.forms.focusAndSelect(el)
Focuses, and optionally selects the content of, a form element.
Arguments:
el : Element
The form element.
code »
goog.dom.forms.getFormDataHelper_(formresultfnAppend)
Returns the form data as a map or an application/x-www-url-encoded string. This doesn't support file inputs.
Arguments:
form : HTMLFormElement
The form.
result : Object
The object form data is being put in.
fnAppend : Function
Function that takes result, an element name, and an element value, and adds the name/value pair to the result object.
code »
goog.dom.forms.getFormDataMap(form) !goog.structs.Map
Returns form data as a map of name to value arrays. This doesn't support file inputs.
Arguments:
form : HTMLFormElement
The form.
Returns: !goog.structs.Map  A map of the form data as form name to arrays of values.
code »
goog.dom.forms.getFormDataString(form) string
Returns the form data as an application/x-www-url-encoded string. This doesn't support file inputs.
Arguments:
form : HTMLFormElement
The form.
Returns: string  An application/x-www-url-encoded string.
code »
goog.dom.forms.getInputChecked_(el) ?string
Gets the current value of a checkable input element.
Arguments:
el : Element
The element.
Returns: ?string  The value of the form element (or null).
code »
goog.dom.forms.getSelectMultiple_(el) ?Array.<string>
Gets the current value of a select-multiple element.
Arguments:
el : Element
The element.
Returns: ?Array.<string>  The value of the form element (or null).
code »
goog.dom.forms.getSelectSingle_(el) ?string
Gets the current value of a select-one element.
Arguments:
el : Element
The element.
Returns: ?string  The value of the form element (or null).
code »
goog.dom.forms.getValue(el) string | Array.<string> | null
Gets the current value of any element with a type.
Arguments:
el : Element
The element.
Returns: string | Array.<string> | null  The current value of the element (or null).
code »
goog.dom.forms.getValueByName(formname) Array.<string> | string | null
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.
Arguments:
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.
code »
goog.dom.forms.hasFileInput(form) boolean
Whether the form has a file input.
Arguments:
form : HTMLFormElement
The form.
Returns: boolean  Whether the form has a file input.
code »
goog.dom.forms.hasValue(el) boolean
Whether a form element has a value.
Arguments:
el : Element
The element.
Returns: boolean  Whether the form has a value.
code »
goog.dom.forms.hasValueByName(formname) boolean
Whether a named form field has a value.
Arguments:
form : HTMLFormElement
The form element.
name : string
Name of an input to the form.
Returns: boolean  Whether the form has a value.
code »
goog.dom.forms.setDisabled(eldisabled)
Enables or disables either all elements in a form or a single form element.
Arguments:
el : Element
The element, either a form or an element within a form.
disabled : boolean
Whether the element should be disabled.
code »
goog.dom.forms.setInputChecked_(elopt_value)
Sets a checkable input element's checked property. #TODO(user): This seems potentially unintuitive since it doesn't set the value property but my hunch is that the primary use case is to check a checkbox, not to reset its value property.
Arguments:
el : Element
The element.
opt_value : string | boolean=
The value, sets the element checked if val is set.
code »
goog.dom.forms.setSelectMultiple_(elopt_value)
Sets the value of a select-multiple element.
Arguments:
el : Element
The element.
opt_value : Array.<string> | string=
The value of the selected option element(s).
code »
goog.dom.forms.setSelectSingle_(elopt_value)
Sets the value of a select-one element.
Arguments:
el : Element
The element.
opt_value : string=
The value of the selected option element.
code »
goog.dom.forms.setValue(elopt_value)
Sets the current value of any element with a type.
Arguments:
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.
code »

Directory dom

File Reference