Prototype guide to the use of learning manuals form.js

Source: Internet
Author: User

This section provides a number of features related to form operations, including the following sections, which can be invoked directly through the $ (element). Method () When the element is returned through the $ methods:

Form object: Provides some ways to manipulate an entire form

Form.element objects: Provides a way to manipulate a form element

Timedobserver class: Periodic form monitor that performs a callback function when the value of the form element changes, with form and element two types

Eventobserver class: Use events to monitor form elements and execute a callback function when the value of the form element changes, with form and element two types

Form.element object:

Focus (Element) Select (Element): The encapsulation of an HTML element's built-in method, in addition to returning the element itself

Serialize (Element): Serializes the specified form element, returns the form of Key=value, and the returned string is encodeURIComponent

GetValue (Element): Returns the value of an element

Clear (Element): Clears the value of an element

Present (Element): Determines whether the value of an element is not empty

Activate (Element): Get the element focus

Disable (Element): Making an element unavailable

Enable (Element): is elements available

The form objects include:

Reset (Form): Form.reset ()

SerializeElements (elements): Serializes the elements in elements to return the QueryString form of all specified elements for easy use in XMLHTTP or elsewhere

Serialize (form): Serializing an entire form

GetElements (Form): Returns all serializable elements of the form

Getinputs (Form, TypeName, name): Returns all input elements that conform to TypeName and name

Disable (Form): Make an entire form unavailable

Enable (form): Is the whole form available

Findfirstelement (Form): Returns the first available non-hidden element of type ' input ', ' select ', ' textarea '

Focusfirstelement (Form): Causes the element returned by Findfirstelement (form) to be focused

$F = Form.Element.getValue easy to use

Form.Element.Observer and Form.observer classes:

Periodically monitors form elements, and executes a callback function if the value of the form or form element changes, as follows:

var oser=new Form.Element.Observer (Element, frequency, callback)

or Oser=new form.observer (Form, frequency, callback)

Callback can define two parameters form/element, form.serialize ()/value

Form.Element.EventObserver and Form.eventobserver classes:

These two classes are similar to the above, but are not periodic monitoring, but instead use the element's change or click event to monitor the changes in the form element, executing callback When a change occurs, with the same parameters as above

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.