Finds the value of the given form element, irrespective of its type. The returned value depends on the form element's type.
Form element to process.
The value of the given form element, usually its tag
name or the type
property of the input element.
Register a callback function for one of the events issued during form validation.
The following events are available:
// Log a console message when the event is triggered
xm_validator.on("start", function(data) { console.log('validate-start', data); });
xm_validator.on("progress", function(data) { console.log('progress', data); });
xm_validator.on("end", function(data) { console.log('validate-end', data) });
Name of the event to listen to.
Callback that is called when the event occurs. The callback receives the index (idx
)
of the form element being validated, a list (items
) of all items to be validated, the current item (item
)
that is being validated, and whether the current item is (valid
).
When the form is submitted and a form field is not valid, the browser window is scrolled so that the invalid field becomes visible. By default, this scrolling is animated. This method can be used to disable the animation so that the scrolling is instantaneous.
Whether to animate the scrolling.
The main interface for interacting with the form validator. You can use it, for example, to listen to certain events during form validation.