The main interface for interacting with the form validator. You can use it, for example, to listen to certain events during form validation.

Hierarchy

  • XmValidator

Index

Methods

Methods

on

  • on(event: "start" | "progress" | "end", eventCallback: function): void
  • Register a callback function for one of the events issued during form validation.

    The following events are available:

    • start: When form validation starts.
    • progress: When progress is made during form validation, ie. every time a single form field was validated. Form validation consists of validation a set of form element, possibly the entire form.
    • end: When form validation finishes.
    // 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) });

    Parameters

    • event: "start" | "progress" | "end"

      Name of the event to listen to.

    • eventCallback: function

      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).

        • (this: undefined, data: object): void
        • Parameters

          • this: undefined
          • data: object
            • idx: number
            • item: JQuery
            • items: JQuery
            • valid: boolean

          Returns void

    Returns void