formcycle 8.4.3 - JavaScript for forms
    Preparing search index...

    Interface Window

    interface Window {
        XFC_METADATA: XfcMetadata;
        XM_FORM_I18N: { [i18nKey: string]: string };
        XM_FORM_MODEL: XmFormModel;
        XM_FORM_PLUGIN_VRULES: Record<string, XmFormPluginVRule>;
        XM_FORM_VRULES: XmFormVrule;
        xm_validator: XmValidator;
        getProjektId(): null | number;
        getURLParameter(name: string): undefined | string;
        gotoPage(pageName: string, validate?: boolean): void;
        setValidate(doValidate: boolean): void;
    }
    Index

    Properties

    XFC_METADATA: XfcMetadata

    This object contains metadata related to the currently opened form; such as the state of the form, the user that is currently signed in, the form record and much more.

    To access this information via JavaScript, use the global JavaScript object window.XFC_METADATA. When you open a form, this object is added automatically and filled with the relevant information.

    XM_FORM_I18N: { [i18nKey: string]: string }

    An object contain all I18N (internationalization) language keys and the corresponding values, such as the error message that shows up when a required field is left blank.

    XM_FORM_MODEL: XmFormModel

    The model for the current form with the validation rules etc. as set in the XIMA form designer.

    XM_FORM_PLUGIN_VRULES: Record<string, XmFormPluginVRule>

    An object that contains all the RegExps for the different data types of input fields provided by plugins. The key is the ID of the validation rule (see Formcycle.XmFormPluginVRule.key).

    XM_FORM_VRULES: XmFormVrule

    An object that contains all the RegExps for the different data types of input fields.

    xm_validator: XmValidator

    A reference to the form validator. It may be used to interact with the validation process, such as listening to certain events during the validation process.

    Methods

    • Returns null | number

      The current ID of the form. null when no form exists.

    • Retrieves the value of the named URL parameter. In case a parameter is specified multiple times, only the value of the first occurrence is returned.

      If the URL is as follows:

      https://formcloud.de/formcycle/form/provide/9999?name=James&preview&mode=&name=John

      Then this function returns:

      getURLParameter("name"); // => "James"
      getURLParameter("preview") // => undefined
      getURLParameter("mode"); // => ""
      getURLParameter("other"); // => undefined

      Parameters

      • name: string

        Name of the URL parameter to retrieve.

      Returns undefined | string

      The value of the URL parameter with the given name, or undefined if no such URL parameter exists.

    • A formcycle form may consist of multiple pages. This function lets you change to another page. You may also specify whether navigation should be prevented in case the current page is invalid (e.g. due to required fields that are still blank).

      // Go to page 2, but only if all form fields on the current page are valid
      gotoPage("p2", true);

      // Go to page 2 and do not check any form fields
      gotoPage("p2");

      Parameters

      • pageName: string

        The name of the page to goto. This is the name given to the page in the designer.

      • Optionalvalidate: boolean

        Set to true to prevent the page change in case the current page is invalid. Set to false to perform the navigation irrespective of whether the current page is valid.

      Returns void

    • Lets you disable or enable form validation. If validation is disabled, the form may be submitted event if it is invalid (e.g. when it contains required fields that are still blank).

      Note that even if form validation is enabled, a client may still submit the form if they disable JavaScript or set up an appropriate HTTP request. To prevent this, you may want to enable server side validation in the designer.

      Parameters

      • doValidate: boolean

        Set to false to disable form validation. Set to true to enable form validation.

      Returns void