SoFunction
Updated on 2025-04-10

Prototype User Guide

This section provides many functions related to form operations, including the following sections. When returning elements through the $ method, they can be called directly through $(element).method():

Form object: provides some methods to manipulate the entire form
Object: Provides a method to manipulate a form element
TimedObserver class: periodic form monitor, executes a callback function when the form element value changes, there are two types: Form and Element
EventObserver class: uses events to monitor form elements. When the form element value changes, a callback function can be executed. There are two types: Form and Element.

Form object:

reset(form):()
serializeElements(elements):Serializing elements in elements is to return the queryString form of all elements specified, which is easy to use in xmlhttp or other places.
serialize(form):Serialize the entire form
getElements(form):Returns all serializable elements of the form
getInputs(form, typeName, name):Return all typesName and name matchinginput element
disable(form):Keep the entire form unavailable
enable(form) :The entire form is available
findFirstElement(form):The return type isThe first non-hidden element available for 'input', 'select', 'textarea'
focusFirstElement(form):makeFindFirstElement(form) returns the element to get focus

Object:

focus(element) select(element):Encapsulation of built-in methods for html elements, except for returning the element itself
serialize(element):Serialize the specified form element, return the form key=value, and the returned string has beenencodeURIComponent
getValue(element):Return the value of the element
clear(element):Clear the value of the element
present(element):Determine whether the value of the element is not empty
activate(element):Give the element focus
disable(element):Make elements unavailable
enable(element):Yes elements available

$F = Easy to use

as well askind:

Periodically monitor form elements. If the value of the form or form element changes, execute a callback function, and use it as follows:

var oser=new (element, frequency, callback)
or oser=new (form, frequency, callback)
callback can define two parameters form/element,()/value

andkind:

These two classes are similar to the above, but are not periodic monitoring, but use the element's change or click event to monitor the changes of form elements. When a change occurs, the parameters are the same as above.