namespace Form
Related utilities
Methods
Instance methods
-
disable
Form#disable() -> Element Form.disable(form) -> ElementDisables the form as a whole. Form controls will be visible but uneditable.
This method can be called either as an instance method or as a generic method. If calling as a generic, pass the instance in as the first argument.
-
enable
Form#enable() -> Element Form.enable(form) -> ElementEnables a fully- or partially-disabled form.
This method can be called either as an instance method or as a generic method. If calling as a generic, pass the instance in as the first argument.
-
findFirstElement
Form#findFirstElement() -> Element Form.findFirstElement(form) -> ElementFinds the first non-hidden, non-disabled control within the form.
This method can be called either as an instance method or as a generic method. If calling as a generic, pass the instance in as the first argument.
-
focusFirstElement
Form#focusFirstElement() -> Element Form.focusFirstElement(form) -> ElementGives keyboard focus to the first element of the form. Returns the form.
This method can be called either as an instance method or as a generic method. If calling as a generic, pass the instance in as the first argument.
-
getElements
Form#getElements() -> [Element...] Form.getElements(form) -> [Element...]Returns a collection of all controls within a form.
This method can be called either as an instance method or as a generic method. If calling as a generic, pass the instance in as the first argument.
-
getInputs
Form#getInputs( [, type [, name]]) -> [Element...] Form.getInputs(form [, type [, name]]) -> [Element...]-
type(String) – A value for thetypeattribute against which to filter. -
name(String) – A value for thenameattribute against which to filter.
Returns a collection of all
INPUTelements in a form.Use optional
typeandnamearguments to restrict the search on these attributes.This method can be called either as an instance method or as a generic method. If calling as a generic, pass the instance in as the first argument.
-
-
request
Form#request([options]) -> Ajax.Request-
options(Object) – Options to pass along to theAjax.Requestconstructor.
A convenience method for serializing and submitting the form via an
Ajax.Requestto the URL of the form’sactionattribute.The
optionsparameter is passed to theAjax.Requestinstance, allowing one to override the HTTP method and/or specify additional parameters and callbacks. -
-
serialize
Form#serialize([, options]) -> String | Object Form.serialize(form[, options]) -> String | Object-
options(Object) – A list of options that affect the return value of the method.
Serialize form data to a string suitable for Ajax requests.
If
options.hashistrue, returns an object of key/value pairs instead (where keys are control names).This method can be called either as an instance method or as a generic method. If calling as a generic, pass the instance in as the first argument.
-
Class methods
-
reset
Form.reset(form) -> ElementResets a form to its default values.
-
serializeElements
Form.serializeElements(elements[, options]) -> String | Object-
elements(Array) – A collection of elements to include in the serialization. -
options(Object) – A list of options that affect the return value of the method.
Serialize an array of form elements to a string suitable for Ajax requests.
If
options.hashistrue, returns an object of key/value pairs instead (where keys are control names). -
