Form

Form is a namespace and a module for all things form-related, packed with form manipulation and serialization goodness.

 

While it holds methods dealing with forms as whole, its submodule Form.Element deals with specific form controls. Most of these methods are also available directly on FORM elements that have been extended (see “How Prototype extends the DOM”).

 

 


Moduleindex

 

disable

 

disable(formElement) -> HTMLFormElement

 

Disables the form as whole. Form controls will be visible but uneditable.

 

enable

 

enable(formElement) -> HTMLFormElement

 

Enables a fully or partially disabled form.

 

findFirstElement

 

findFirstElement(formElement) -> HTMLElement

 

Finds first non-hidden, non-disabled form control.

 

focusFirstElement

 

focusFirstElement(formElement) -> HTMLFormElement

 

Gives keyboard focus to the first element of the form.

 

getElements

 

getElements(formElement) -> array

 

Returns a collection of all form controls within a form.

 

getInputs

 

getInputs(formElement [, type [, name]]) -> array

 

Returns a collection of all INPUT elements in a form. Use optional type and name arguments to restrict the search on these attributes.

 

reset

 

reset(formElement) -> HTMLFormElement

 

Resets a form to its default values.

 

serialize

 

serialize(formElement) -> string

 

Serialize form data to a string suitable for Ajax requests.

 

serializeElements

 

serializeElements(elements) -> string

 

Serialize an array of form elements.

 


Prototype API 1.5.0 - prototypejs.org