External module "formcycle-v6.d"

Index

Variables

Const XFC_METADATA

XFC_METADATA: XfcMetadata

This object contains meta data related to the currently opened form; such as the state of the form, the user that is currently signed in, the 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.

Const XM_FORM_I18N

XM_FORM_I18N: object

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

Type declaration

  • [i18nKey: string]: string

Const XM_FORM_MODEL

XM_FORM_MODEL: XmFormModel

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

Const XM_FORM_PLUGIN_VRULES

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

Const XM_FORM_VRULES

XM_FORM_VRULES: XmFormVrule

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

Const xm_validator

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.

Functions

getProjektId

  • getProjektId(): number | null
  • Returns number | null

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

getURLParameter

  • getURLParameter(name: string): string | undefined
  • Retrieves the value of the named URL parameter. In case a parameter is specified multiple times, only the value of the first occurence 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 string | undefined

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

gotoPage

  • gotoPage(pageName: string, validate?: boolean): void
  • 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 (eg. 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.

    • Optional validate: 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

setValidate

  • setValidate(doValidate: boolean): void
  • Lets you disable or enable form validation. If validation is disabled, the form may be submitted event if it is invalid (eg. 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 setup 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