Skip to main content

getFormByMarker

Getting one form object by marker.

Description

This method retrieves a single form object based on its textual identifier (marker) from the API. It returns a Promise that resolves to a FormEntity object.

Forms.getFormByMarker(

marker*, langCode

);

Parameters schema

Schema

marker(required): string
Marker of form
example: "contact_form"

langCode: string
Language code. Default: "en_US"
example: "en_US"

Try it live

Run this method interactively in the JS SDK sandbox — on first visit, connect your Project URL and App Token, then open any scenario below to see Forms.getFormByMarker() in action:

  • Submit a form — fetch a contact form by marker and post user input back to OneEntry.
  • Entity form — handle a form that contains an entity-type field (pages or products).
  • File form — submit a form that includes a file attachment.
  • Spam form — submit a form with spam protection.
  • Schedule form — pick a time slot from a timeInterval field and submit it.
  • Formik form — build a Formik form from a OneEntry form config using useFormConfig.
  • Register user — use a sign-up form to create a new account.

Examples

Minimal example

const response = await Forms.getFormByMarker('my-form');

Example with attributes

const response = await Forms.getFormByMarker('my-form', 'en_US');

Example response

{
"id": 6,
"attributeSetId": 15,
"type": "data",
"localizeInfos": {
"title": "Test form",
"titleForSite": "",
"successMessage": "",
"unsuccessMessage": "",
"urlAddress": "",
"database": "0",
"script": "0"
},
"version": 14,
"position": 1,
"identifier": "test-form",
"processingType": "script",
"templateId": null,
"attributes": [
{
"type": "string",
"marker": "name",
"isLogin": false,
"isSignUp": false,
"position": 1,
"settings": {},
"isVisible": true,
"isPassword": false,
"listTitles": [],
"validators": {
"requiredValidator": {
"strict": true
},
"stringInspectionValidator": {
"stringMax": 0,
"stringMin": 0,
"stringLength": 0
}
},
"initialValue": null,
"localizeInfos": {
"title": "Name"
},
"additionalFields": {
"additional_field": {
"type": "string",
"value": "Additional field data",
"marker": "additional_field"
}
},
"isSignUpRequired": false,
"isNotificationEmail": false,
"isNotificationPhoneSMS": false,
"isNotificationPhonePush": false
},
{
"type": "file",
"marker": "file",
"isLogin": false,
"isSignUp": false,
"position": 2,
"settings": {},
"isVisible": true,
"isPassword": false,
"listTitles": [],
"validators": {},
"initialValue": null,
"localizeInfos": {
"title": "File"
},
"additionalFields": {},
"isSignUpRequired": false,
"isNotificationEmail": false,
"isNotificationPhoneSMS": false,
"isNotificationPhonePush": false
}
],
"total": "1",
"moduleFormConfigs": [
{
"id": 2,
"moduleIdentifier": "content",
"isGlobal": false,
"isClosed": false,
"viewOnlyUserData": false,
"commentOnlyUserData": false,
"entityIdentifiers": [
{
"id": "blog",
"isNested": false
}
],
"ratingCalculation": "average",
"allowHalfRatings": null,
"maxRatingScale": null,
"isAnonymous": null,
"allowRerating": null,
"isRating": null
}
]
}

Response schema

Schema: IFormsEntity

id: number
The identifier of the object.
example: 12345

attributeSetId: number | null
The identifier of the attribute set being used, or null if not applicable.
example: 1234

type: string | null
Form type.
example: "contact"

localizeInfos: IFormLocalizeInfo
The name of the form and form-side localization fields (success/error messages, processing config, etc.).
example:

{
"key": "value"
}

version: number
The version number of the object.
example: 1

position: number
The position of the object.
example: 1

identifier: string
The textual identifier for the record field.
example: "form_contact_us"

processingType: string
Type of form processing.
example: "async"

templateId: number | null
The identifier of the template used by the form, or null if no template is used.
example: 6789

attributes: IFormAttribute[]
Form fields with their localization, validators and form-specific flags.

attributes.marker: string
Field marker (machine name).
example: "email"

attributes.type: AttributeType
Attribute data type (e.g. "string", "file").

attributes.position: number
Sort position of the field.
example: 1

attributes.isVisible: boolean
Whether the field is exposed to the user.
example: true

attributes.localizeInfos: IAttributeLocalizeInfo
Localized labels for the field. For timeInterval attributes, also carries the intervals schedule payload.

attributes.initialValue: unknown
Default value applied when the field is not filled.

attributes.listTitles: IListTitle[]
Predefined options for list/radioButton fields; empty array for other types.

listTitles.title: string
The title or name associated with the list item.
example: "Item Name"

listTitles.value: number | string
The value of the list item, which can be either a number or a string depending on the context.
example: 42

listTitles.position: string | number | null
The position of the list item, which can be represented as a string, number, or null if not applicable.
example: 1

listTitles.extended: object
An object containing additional properties or metadata related to the list item. This could include any extra details that extend the basic information.

listTitles.extended.value: string | null
The extended value, which can be a string or null.
example: "extra_value"

listTitles.extended.type: string | null
The type of the extended value, which can be a string or null.
example: "color"

attributes.validators: IAttributeValidators
Validation rules; empty object when no validators are configured.

validators.requiredValidator: object
Marks the field as required. Shape: { strict: boolean }.
example: { strict: true }

validators.stringInspectionValidator: object
Length constraints for string fields. Shape: { stringMin: number; stringMax: number; stringLength: number }.

validators.emailInspectionValidator: boolean
Toggle for email-format validation.

validators.defaultValueValidator: object
Default value configuration with optional custom error text. Shape: { customErrorText?: string; fieldDefaultValue?: unknown; fieldDefaultValue2?: unknown }.

attributes.settings: Record<string, unknown>
Field-specific configuration; empty object by default.

attributes.additionalFields: Record<string, IFormAttributeAdditionalField>
Nested sub-fields keyed by marker; empty object when none.

attributes.isLogin: boolean
Whether this field carries the login value used for authentication.
example: false

attributes.isSignUp: boolean
Whether this field is required during sign-up.
example: false

attributes.isPassword: boolean
Whether this field carries the password value used for authentication.
example: false

attributes.isSignUpRequired: boolean
Whether this field is required during sign-up.
example: false

attributes.isNotificationEmail: boolean
Whether this field stores the email used for notifications.
example: false

attributes.isNotificationPhonePush: boolean
Whether this field stores the phone number used for push notifications.
example: false

attributes.isNotificationPhoneSMS: boolean
Whether this field stores the phone number used for SMS notifications.
example: false

total: number | string
Total count of related entries.
example: "1"

moduleFormConfigs: IFormConfig[]
Array of module form configurations associated with the form.

moduleFormConfigs.id: number
The identifier of the form configuration.
example: 123

moduleFormConfigs.formIdentifier: string
The form identifier (only in products/pages API).
example: "review"

moduleFormConfigs.moduleIdentifier: string
The identifier of the module associated with the form configuration.
example: "module_identifier"

moduleFormConfigs.isGlobal: boolean
Indicates whether the form configuration is global.
example: true

moduleFormConfigs.isClosed: boolean
Indicates whether the form configuration is closed.
example: true

moduleFormConfigs.isModerate: boolean
Indicates whether the form requires moderation (only in products/pages API).
example: false

moduleFormConfigs.viewOnlyUserData: boolean
Indicates whether the form configuration allows viewing user data (used in forms API).
example: true

moduleFormConfigs.commentOnlyUserData: boolean
Indicates whether the form configuration allows commenting on user data (used in forms API).
example: true

moduleFormConfigs.viewOnlyMyData: boolean
Indicates whether the form configuration allows viewing my data (used in products/pages API).
example: false

moduleFormConfigs.commentOnlyMyData: boolean
Indicates whether the form configuration allows commenting on my data (used in products/pages API).
example: false

moduleFormConfigs.entityIdentifiers: object[]
An array of entity identifiers associated with the form configuration.

moduleFormConfigs.nestedEntityIdentifiers: string[]
An array of nested entity identifier strings (only in products/pages API).
example: ["catalog"]

moduleFormConfigs.exceptionIds: string[]
An array of exception identifiers.

moduleFormConfigs.formDataCount: number
Total count of form data entries (only in products/pages API).
example: 306

moduleFormConfigs.entityFormDataCount: Record<string, number>
Form data count per entity identifier (only in products/pages API).
example: {"catalog": 306}

moduleFormConfigs.isRating: boolean | null
Indicates whether this form config is for ratings.
example: null

moduleFormConfigs.isAnonymous: boolean | null
Indicates whether anonymous submissions are allowed.
example: null

moduleFormConfigs.allowHalfRatings: boolean | null
Indicates whether half ratings are allowed.
example: null

moduleFormConfigs.allowRerating: boolean | null
Indicates whether re-rating is allowed.
example: null

moduleFormConfigs.maxRatingScale: number | null
Maximum rating scale value.
example: 5

moduleFormConfigs.ratingCalculation: string
Rating calculation method.
example: "average"