Prototype Form.Element Management


Form.emement is a submodule of Form which deals with specific form controls on INPUT, SELECT and TEXTAREA elements.

Form.Element is also aliased Field. Following two forms are equivalent:


is equivalent to:


Which in turn equivalent to:


Here is a complete list of all the methods related to Form.Element.

Prototype Event Methods

NOTE: Make sure you at least have the version 1.6 of prototype.js.

activate()Gives focus to a form control and selects its contents if it is a text input.
clear()Clears the contents of a text input.
disable()Disables a form control, effectively preventing its value to be changed until it is enabled again.
enable()Enables a previously disabled form control.
focus()Gives keyboard focus to an element.
getValue()Returns the current value of a form control. A string is returned for most controls; only multiple select boxes return an array of values. The global shortcut for this method is $F().
present()Returns true if a text input has contents, false otherwise.
select()Selects the current text in a text input.
serialize()Creates an URL-encoded string representation of a form control in the name=value format.