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

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

    interface XfcMetadata {
        attachments: MetadataAttachment[];
        currentClient: MetadataClient;
        currentLanguage: string;
        currentLanguageTag: string;
        currentProcess: MetadataProcess;
        currentProject: MetadataProject;
        currentSessionFRID: string;
        currentSessionID: string;
        currentSessionSID?: string;
        currentUser: MetadataCurrentUser;
        limits: MetadataFormLimits;
        pluginResults: Record<string, JSON>;
        renderStatus: string;
        requestType: FormRequestType;
        serverTime: Date;
        serverValidationErrors?: Record<string, string[]>;
        sessionTimeout: number;
        urlParams: { [urlParamKey: string]: string };
        urls: MetadataUrls;
        user: MetadataUser;
    }
    Index

    Properties

    attachments: MetadataAttachment[]

    A list of all attachments of the current form record.

    This includes only files that were uploaded with an upload element in the form. It does not include files uploaded in the inbox. This list is empty when the form was not submitted or saved yet. You can access this property when the form is opened in the inbox to check the attachments.

    currentClient: MetadataClient

    The client to which the current form belongs to.

    currentLanguage: string

    Short name of the current language, e.g. default, en, or de`.

    currentLanguageTag: string

    The current language and variant, e.g. default, en-US, or de-DE.

    currentProcess: MetadataProcess

    The current form record. An empty object when no form records exists, i.e. when the form was not submitted yet.

    currentProject: MetadataProject

    Data related to the current form, such as its ID or its name.

    currentSessionFRID: string

    The current form request session ID, e.g. 88b4069a-b489-454d-9c1c-350ab4a2e83d. This session ID is created when the user opens a form, and it is valid until the user submits (or saves) the form. A user may have multiple form session IDs when they open a form multiple times in different tabs. This is a security feature and also prevents a form from being submitted more than once, such as when the user presses the submit button twice.

    currentSessionID: string

    The current J2EE application container session ID (JSESSIONID), e.g. 5151BE9E69A42FE78D98580E24B3F23B. When a user opens multiple tabs with a form, the session ID will be the same - for an ID unique to each form, see currentSessionFRID.

    currentSessionSID?: string

    The current J2EE application container session ID (JSESSIONID) as an encrypted string, e.g. k7uZbDeNbKXPrWr0TPldmmpa7yUn8csAh++PGxNlgqOiuHo1iqh8LvqIWbdvteZ/+JMRbzSZZfBGg7ohj9UN2A==.

    When a user opens multiple tabs with a form, the session ID will be the same - for an ID unique to each form, see currentSessionFRID.

    Available only when the form is opened externally (via the URL parameter xfc-pp-external=true).

    currentUser: MetadataCurrentUser

    The currently signed-in user. In case the user is not signed in, the user data refers to an anonymous user. For example, the username will be null.

    This property is deprecated, you should use XFC_METADATA.user instead. Please note that some properties of that object are different, e.g. XFC_METADATA.currentUser.surename is now XFC_METADATA.user.firstName.

    Various limits for the form, such as the global file upload limit.

    pluginResults: Record<string, JSON>

    The results of a pre-render plugin. A pre-render plugin is executed before the form is rendered and may add data to the form, such as the result of contacting a web service. This object contains the plugin results with one key for each plugin name.

    renderStatus: string

    The state that was used to render the form. Please note that this state may be different from the state of the form record associated (if any) with the current form. For example, when you open a preview of the form in the designer, you can choose to preview the form in different states. Depending on which state you choose, the value of this property will be different. However, as it is a preview, there is no associated form record, so XFC_METADATA.currentProcess.status will be empty.

    requestType: FormRequestType

    Possible request types for forms that indicate how the form was opened. Some of these options are only for internal use and should not be used.

    • provide: When the form was opened for the first time and not submitted yet. No form records exists yet for the form.
    • preview: Preview of a form, i.e. when you open the form in the preview mode of the designer.
    • print: When the form was opened by the server to generate a printed document, such as a PDF document or an image.
    • process: Processing a form. This is set when the form is submitted.
    • review: When the form is opened in the inbox. A form record now exists for the form.
    serverTime: Date

    The current time of the server. Use this instead of new Date() to retrieve the current time without having to rely on the client's browser or OS.

    serverValidationErrors?: Record<string, string[]>

    A map between the ID of a form element and a list of server validation error messages that were produced during server validaton. This property exists only when the form was submitted and server validation failed, resulting in the form being returned by the request. This is used, for example, by formcycle to display the server validation errors for repeated elements.

    sessionTimeout: number

    The time in seconds it takes for the HTTP session to timeout. Unless disabled, the form attempts to keep the session alive via repeated AJAX requests to the form server.

    urlParams: { [urlParamKey: string]: string }

    An object of all URL parameters in the URL of the current page.

    An object with all formcycle-specific resources, such as database queries or plugin servlets. You should always use these URLs instead of hard-coding URLs. This way you can make sure that your code keeps working even when the URL to the formcycle system changes.

    The currently signed-in user. In case the user is not signed in, the user data refers to an anonymous user. For example, the universalReferenceId is set to ANONYMOUS.