A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://surveyjs.io/form-library/documentation/api-reference/survey-data-model below:

API Reference: Survey Data Model

Returns startPage if the survey currently displays a start page; otherwise, returns currentPage.

Type:
any readonly
Implemented in:
SurveyModel
See also:
startPage * , currentPage * , firstPageIsStartPage

Adds an element to the survey layout.

This method accepts an object with the following layout element properties:

View Demo

Type:
(layoutElement: ISurveyLayoutElement) => ISurveyLayoutElement
Parameters:
layoutElement, type: ISurveyLayoutElement ,

A layout element configuration.

Return Value:

The configuration of the previous layout element with the same id.

Implemented in:
SurveyModel

Adds a custom navigation item similar to the Previous Page, Next Page, and Complete buttons. Accepts an object described in the IAction help section.

View Demo

Type:
(val: IAction) => Action
Parameters:

val, type: IAction

Implemented in:
SurveyModel

Creates a new page and adds it to the survey.

If you want to switch a survey to the newly added page, assign its index to the currentPageNo property or assign the entire page to the currentPage property.

Type:
(name?: string, index?: number) => PageModel
Parameters:
name, type: string ,

A page name. If you do not specify this parameter, it will be generated automatically.

index, type: number ,

An index at which to insert the page. If you do not specify this parameter, the page will be added to the end.

Return Value:

The created and added page.

Implemented in:
SurveyModel
See also:
addPage * , createNewPage

Adds an existing page to the survey.

Type:
(page: PageModel, index?: number) => void
Parameters:
page, type: PageModel ,

A page to add.

index, type: number ,

An index at which to insert the page. If you do not specify this parameter, the page will be added to the end.

Implemented in:
SurveyModel
See also:
addNewPage * , createNewPage

Applies a specified theme to the survey.

Themes & Styles

Type:
(theme: ITheme) => void
Parameters:
theme, type: ITheme ,

An ITheme object with theme settings.

Implemented in:
SurveyModel

Specifies whether to complete the survey automatically after a user answers all questions on the last page. Applies only if the autoAdvanceEnabled property is true.

Default value: true

Type:
boolean writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
True
Implemented in:
SurveyModel
See also:
`settings.autoAdvanceDelay`

Specifies whether the survey switches to the next page automatically after a user answers all questions on the current page.

Default value: false

If you enable this property, the survey is also completed automatically. Set the autoAdvanceAllowComplete property to false if you want to disable this behavior.

If any of the following questions is answered last, the survey does not switch to the next page: Checkboxes, Yes/No (Boolean) (rendered as Checkbox), Long Text, Signature, Image Picker (with Multi Select), File Upload, Single-Select Matrix (not all rows are answered), Dynamic Matrix, Dynamic Panel.

View Demo

Type:
boolean writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
See also:
`settings.autoAdvanceDelay`

Specifies whether to focus the first question with a validation error on the current page.

Default value: true

Type:
boolean writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
True
Implemented in:
SurveyModel
See also:
validate * , autoFocusFirstQuestion

Specifies whether to focus the first question on the page on survey startup or when users switch between pages.

Default value: false in v1.9.114 and later, true in earlier versions

Type:
boolean writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
See also:
autoFocusFirstError * , focusFirstQuestion * , focusQuestion

An image to display in the background of the survey or form. Accepts a base64 or URL string value.

Type:
string readonly

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
See also:
backgroundOpacity

A value from 0 to 1 that specifies how transparent the background image should be: 0 makes the image completely transparent, and 1 makes it opaque.

Type:
number writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
1
Implemented in:
SurveyModel

An array of calculated values.

View Demo

Type:
CalculatedValue[] writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel

Specifies when the survey validates answers.

Possible values:

In SurveyJS Form Library v1.12.5 and earlier, the "onValueChanged" mode doesn't work with date input fields because of the way browsers process date values. In most browsers, the value is considered changed as soon as a user starts entering the date in a text input field. This means that a user may only enter the day without having the chance to enter the month and year before validation is triggered. For this reason, date input fields are validated before the survey is switched to the next page or completed. Starting with v1.12.6, "onValueChanged" works for date input fields as well as for input fields of other types.

Refer to the following help topic for more information: Data Validation.

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
onNextPage
Accepted values:
onNextPage , onValueChanged , onComplete
Implemented in:
SurveyModel
See also:
validationEnabled * , validationAllowSwitchPages * , validationAllowComplete * , validate

Opens a dialog window for users to select files.

Type:
(input: any, callback: (files: any[]) => void, context?: { element: Base; item?: any; elementType?: string; propertyName?: string; }) => void
Parameters:
callback, type: (files: any[]) => void ,

A callback function that you can use to process selected files. Accepts an array of JavaScript File objects.

context, type: { element: Base; item?: any; elementType?: string; propertyName?: string; }

Implemented in:
SurveyModel
See also:
onOpenFileChooser * , onUploadFile

Resets the survey state and, optionally, data. If state is "completed", it becomes "running".

Type:
(clearData?: boolean, goToFirstPage?: boolean) => void
Parameters:
clearData, type: boolean ,

(Optional) Specifies whether to clear survey data. Default value: true.

goToFirstPage, type: boolean ,

(Optional) Specifies whether to switch the survey to the first page. Default value: true.

Implemented in:
SurveyModel

Specifies whether to remove disabled choices from the value in Dropdown, Checkboxes, and Radio Button Group questions.

Default value: false

This property cannot be specified in the survey JSON schema. Use dot notation to specify it.

Type:
boolean writable
Implemented in:
SurveyModel

Removes values that cannot be assigned to a question, for example, choices unlisted in the choices array.

Call this method after you assign new question values in code to ensure that they are acceptable.

This method does not remove values that fail validation. Call the validate() method to validate newly assigned values.

Type:
(removeNonExistingRootKeys?: boolean) => void
Parameters:
removeNonExistingRootKeys, type: boolean ,

Pass true to remove values that do not correspond to any question or calculated value.

Implemented in:
SurveyModel

Specifies when to remove values of invisible questions from survey results.

Possible values:

Type:
any writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
onComplete
Accepted values:
none , onComplete , onHidden , onHiddenContainer
Implemented in:
SurveyModel
See also:
Conditional Visibility , onComplete

Deletes an answer from survey results.

Type:
(name: string) => void
Parameters:
name, type: string ,

An object property that stores the answer to delete. Pass a question's valueName or name.

Implemented in:
SurveyModel

Creates a new object that has the same type and properties as the current SurveyJS object.

Type:
() => Base
Implemented in:
Base

HTML content displayed to a user who has completed the survey before. To identify such users, the survey uses a cookie name.

View Demo

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
See also:
processedCompletedBeforeHtml

An array of objects that allows you to specify different HTML content for the complete page.

Each object should include the expression and html properties. When expression evaluates to true, the survey uses the corresponding HTML markup instead of completedHtml. Refer to the following help topic for more information about expressions: Expressions.

View Demo

Type:
HtmlConditionItem[] writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
Type:
() => boolean
Implemented in:
SurveyModel

Gets or sets a caption for the Complete button.

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
See also:
Localization & Globalization

A cookie name used to save information about survey completion.

When this property has a value, the survey creates a cookie with the specified name on completion. This cookie helps ensure that users do not pass the same survey twice. On the second run, they will see the Completed Before page.

View Demo

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
See also:
clientId

Creates and returns a new page but does not add it to the survey.

Call the addPage(page) method to add the created page to the survey later or the addNewPage(name, index) method to create and add a page to the survey.

Type:
(name: string) => PageModel
Parameters:

name, type: string

Implemented in:
SurveyModel
See also:
addPage * , addNewPage

Gets or sets an object in which keys are UI elements and values are CSS classes applied to them.

View Demo

Type:
any writable
Implemented in:
SurveyModel

Gets or sets the current page, panel, or question (depends on the questionsOnPageMode value).

The following table illustrates the dependency between questionsOnPageMode values and the types of survey elements that the currentElement property can contain:

questionsOnPageMode Survey element "standard" or "singlePage" Page "questionPerPage" Question or Panel "inputPerPage" Question
Type:
ISurveyElement writable
Implemented in:
SurveyModel

Specifies the current page, panel, or question (depends on the questionsOnPageMode value) using its name.

The following table illustrates the dependency between questionsOnPageMode values and the types of survey elements that the currentElementName property can specify:

questionsOnPageMode Survey element "standard" or "singlePage" Page "questionPerPage" Question or Panel "inputPerPage" Question
Type:
string writable
Implemented in:
SurveyModel
See also:
currentElement

Gets or sets the current page.

If you want to change the current page, set this property to a PageModel object. You can get this object in different ways. For example, you can call the getPageByName() method to obtain a PageModel object with a specific name:

survey.currentPage = survey.getPageByName("my-page-name");

Alternative ways to change the current page are listed below:

The currentPage property does not return the start page even if it is current. Use the activePage property instead if your survey contains a start page.

Type:
any writable
Implemented in:
SurveyModel

A zero-based index of the current page in the visiblePages array.

View Demo

Type:
number writable
Implemented in:
SurveyModel
See also:
visiblePages

Gets or sets an object with survey results. You can set this property with an object of the following structure:

{
  question1Name: question1Value,
  question2Name: question2Value,
  // ...
}

View Demo

When you set the data property in code, the new object overrides the old object that may contain default question values and entered data. If you want to merge the new and old objects, call the mergeData(newDataObj) method.

If you assign a new object while a respondent takes the survey, set the currentPageNo property to 0 to start the survey from the beginning. This will also cause the survey to re-evaluate the visibleIf, enableIf, and other expressions.

Type:
any writable
Implemented in:
SurveyModel
See also:
setValue * , getValue

Disposes of the survey model.

Call this method to release resources if your application contains multiple survey models or if you re-create a survey model at runtime.

Type:
() => void
Implemented in:
SurveyModel

Completes the survey.

When you call this method, Form Library performs the following actions:

  1. Saves a cookie if the cookieName property is set.
  2. Switches the survey state to "completed".
  3. Raises the onComplete event.
  4. Navigates the user to a URL specified by the navigateToUrl or navigateToUrlOnCondition property.

The doComplete() method completes the survey regardless of validation errors and the current page. If you need to ensure that survey results are valid and full, call the completeLastPage() method instead.

Type:
(isCompleteOnTrigger?: boolean, completeTrigger?: Trigger) => boolean
Parameters:
isCompleteOnTrigger, type: boolean ,

For internal use.

completeTrigger, type: Trigger ,

For internal use.

Return Value:

false if survey completion is cancelled within the onCompleting event handler; otherwise, true.

Implemented in:
SurveyModel

Gets or sets a caption for the Edit button displayed when the survey shows a preview of given answers.

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
See also:
showPreviewBeforeComplete * , cancelPreview * , previewText

A message that is displayed when a survey does not contain visible pages or questions.

Type:
string writable
Implemented in:
SurveyModel
See also:
Localization & Globalization
Type:
boolean writable
Implemented in:
SurveyModel

Gets or sets a Boolean value that specifies whether the first page is a start page.

Refer to the following help topic for more information: Start Page.

Type:
boolean writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
See also:
startPage * , activePage

Focuses a question with a specified name. Switches the current page if needed.

Type:
(name: string) => boolean
Parameters:
name, type: string ,

A question name.

Return Value:

false if the survey does not contain a question with the specified name or this question is hidden; otherwise, true.

Implemented in:
SurveyModel
See also:
focusFirstQuestion * , autoFocusFirstQuestion

Assigns a new JSON schema to the current survey element.

The JSON schema should contain only serializable properties of this survey element. Event handlers and properties that do not belong to the survey element are ignored.

Type:
(json: any, options?: ILoadFromJSONOptions) => void
Parameters:
json, type: any ,

A JSON schema that you want to apply to the current survey element.

options, type: ILoadFromJSONOptions ,

An object with configuration options.

options.validatePropertyValues, type: boolean ,

Pass true if you want to validate property values. Use the jsonErrors array to access validation errors.

Implemented in:
Base
See also:
toJSON

Returns a list of all panels in the survey.

Type:
(visibleOnly?: boolean, includeDesignTime?: boolean) => IPanel[]
Parameters:
visibleOnly, type: boolean ,

A Boolean value that specifies whether to include only visible panels.

includeDesignTime, type: boolean ,

For internal use.

Return Value:

An array of panels.

Implemented in:
SurveyModel
See also:
getPanelByName

Returns a list of all questions in the survey.

Type:
(visibleOnly?: boolean, includeDesignTime?: boolean, includeNested?: boolean) => Question[]
Parameters:
visibleOnly, type: boolean ,

A Boolean value that specifies whether to include only visible questions.

includeDesignTime, type: boolean ,

For internal use.

includeNested, type: boolean ,

A Boolean value that specifies whether to include nested questions, such as questions within matrix cells.

Return Value:

An array of questions.

Implemented in:
SurveyModel
See also:
getQuestionByName

Returns an object with survey results.

If you want to get a survey results object that mirrors the survey structure, call the getData() method with an object that has the includePages and includePanels properties enabled. Without this object, the getData() method returns the data property value.

import { Model } from "survey-core";

const surveyJson = { ... };
const survey = new Model(surveyJson);
survey.getData({ includePages: true, includePanels: true });
Type:
(options?: { includePages?: boolean; includePanels?: boolean; }) => any
Parameters:

options, type: { includePages?: boolean; includePanels?: boolean; }

Implemented in:
SurveyModel

Returns a page, panel, or question with a specified name.

Type:
(name: string) => ISurveyElement
Parameters:
name, type: string ,

A survey element name.

Return Value:

A survey element with the specified name.

Implemented in:
SurveyModel
See also:
currentElementName

Returns the number of incorrect answers in a quiz.

For more information about quizzes, refer to the following tutorial: Create a Quiz.

Type:
() => number
Return Value:

The number of incorrect answers in a quiz.

Implemented in:
SurveyModel
See also:
getCorrectAnswerCount

Returns a page to which a specified survey element (question or panel) belongs.

Type:
(element: IElement) => PageModel
Parameters:
element, type: IElement ,

A question or panel instance.

Implemented in:
SurveyModel

Returns a page with a specified name.

Type:
(name: string) => PageModel
Parameters:
name, type: string ,

A page name.

Return Value:

A page with the specified name.

Implemented in:
SurveyModel

Returns a page to which a specified question belongs.

Type:
(question: IQuestion) => PageModel
Parameters:
question, type: IQuestion ,

A question instance.

Implemented in:
SurveyModel

Returns a panel with a specified name.

Type:
(name: string, caseInsensitive?: boolean) => PanelModel
Parameters:
name, type: string ,

A panel name.

caseInsensitive, type: boolean

Return Value:

A panel with the specified name.

Implemented in:
SurveyModel
See also:
getAllPanels

Returns survey results as an array of objects in which the question name, title, value, and other parameters are stored as individual properties.

If a question can have more than one value (Matrix, Multiple Text), its object enables the isNode flag and stores information about these values in the data property. Refer to the following help topic for more information: Access Full Survey Results.

If you want to skip empty answers, pass an object with the includeEmpty property set to false.

Type:
(options?: IPlainDataOptions) => IQuestionPlainData[]
Parameters:

options, type: IPlainDataOptions

Implemented in:
SurveyModel

Returns a JsonObjectProperty object with metadata about a serializable property that belongs to the current SurveyJS object.

If the property is not found, this method returns null.

Type:
(propName: string) => JsonObjectProperty
Parameters:
propName, type: string ,

A property name.

Implemented in:
Base

Returns the value of a property with a specified name.

If the property is not found or does not have a value, this method returns either undefined, defaultValue specified in the property configuration, or a value passed as the defaultValue parameter.

Type:
(name: string, defaultValue?: any, calcFunc?: () => any) => any
Parameters:
name, type: string ,

A property name.

defaultValue, type: any ,

(Optional) A value to return if the property is not found or does not have a value.

calcFunc, type: () => any

Implemented in:
Base

Returns a question with a specified name.

Type:
(name: string, caseInsensitive?: boolean) => Question
Parameters:
name, type: string ,

A question name.

caseInsensitive, type: boolean

Return Value:

A question with the specified name.

Implemented in:
SurveyModel
See also:
getAllQuestions * , getQuestionByValueName

Returns a question with a specified valueName.

Since valueName does not have to be unique, multiple questions can have the same valueName value. In this case, the getQuestionByValueName() method returns the first such question. If you need to get all questions with the same valueName, call the getQuestionsByValueName() method.

Type:
(valueName: string, caseInsensitive?: boolean) => Question
Parameters:
valueName, type: string ,

A question's valueName property value.

caseInsensitive, type: boolean

Return Value:

A question with a specified valueName.

Implemented in:
SurveyModel
See also:
getAllQuestions * , getQuestionByName

Returns all questions with a specified valueName. If a question's valueName is undefined, its name property is used.

Type:
(valueName: string, caseInsensitive?: boolean) => Question[]
Parameters:
valueName, type: string ,

A question's valueName property value.

caseInsensitive, type: boolean

Return Value:

An array of questions with a specified valueName.

Implemented in:
SurveyModel
See also:
getAllQuestions * , getQuestionByName

Returns the number of quiz questions. A question counts if it is visible, has an input field, and specifies correctAnswer.

This number may be different from getQuizQuestions().length because certain question types (for instance, matrix-like types) include more than one question.

For more information about quizzes, refer to the following tutorial: Create a Quiz.

Type:
() => number
Return Value:

The number of quiz questions.

Implemented in:
SurveyModel
See also:
getQuizQuestions

Returns an array of quiz questions. A question counts if it is visible, has an input field, and specifies correctAnswer.

For more information about quizzes, refer to the following tutorial: Create a Quiz.

Type:
() => IQuestion[]
Return Value:

An array of quiz questions.

Implemented in:
SurveyModel
See also:
getQuizQuestionCount
Type:
(resultId: string, questionName: string) => void
Parameters:

resultId, type: string

questionName, type: string

Implemented in:
SurveyModel

Returns the object type as it is used in the JSON schema.

Type:
() => string
Implemented in:
Base

Returns a value (answer) for a question with a specified name.

Type:
(name: string) => any
Parameters:
name, type: string ,

A question name.

Return Value:

A question value (answer).

Implemented in:
SurveyModel
See also:
data * , setValue
Type:
boolean writable
Implemented in:
SurveyModel

Enables the grid layout, which structures form elements using a column-based system.

Default value: false

Specify the gridLayoutColumns property for pages and panels to configure layout columns. Set the colSpan property for an individual question or panel to adjust how many columns this survey element spans.

Type:
boolean readonly

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel

Indicates whether the browser has a cookie with a specified cookieName. If this property's value is true, the respondent has passed the survey previously.

Type:
boolean readonly
Implemented in:
SurveyModel
See also:
setCookie * , deleteCookie

Returns true if the current page does not contain errors.

Type:
boolean readonly
Implemented in:
SurveyModel
See also:
currentPage

Use this method to find out if the current object is of a given typeName or inherited from it.

Type:
(typeName: string) => boolean
Parameters:
typeName, type: string ,

One of the values listed in the getType() description.

Return Value:

true if the current object is of a given typeName or inherited from it.

Implemented in:
Base
See also:
getType

Indicates whether the current page is the first page.

If the survey displays the start page, this property contains false. Use the isStartPageActive property to find out whether the start page is currently displayed.

Type:
boolean readonly
Implemented in:
SurveyModel

Indicates whether the current page is the last page.

Type:
boolean readonly
Implemented in:
SurveyModel

Returns true if the object configuration is being loaded from JSON.

Type:
boolean readonly
Implemented in:
Base

Returns true if the survey element is a page.

This property returns false for PageModel objects in the following cases:

In those cases, the survey creates an internal PageModel object to show all questions on one page, and all regular pages become panels.

Type:
boolean readonly
Implemented in:
SurveyElementCore

Returns true if the survey element is a panel or acts as one.

This property returns true for PageModel objects in the following cases:

In those cases, the survey creates an internal PageModel object to show all questions on one page, and all regular pages become panels.

Type:
boolean readonly
Implemented in:
SurveyElementCore

Returns true if the survey element is a question.

Type:
boolean readonly
Implemented in:
SurveyElementCore
Type:
boolean readonly
Implemented in:
SurveyModel

A Boolean value that indicates whether the start page is currently displayed.

Type:
boolean readonly
Implemented in:
SurveyModel

Returns true if the element is a survey.

Type:
boolean readonly
Implemented in:
SurveyElementCore

Returns true if a passed value is an empty string, array, or object or if it equals to undefined or null.

Type:
(value: any, trimString?: boolean) => boolean
Parameters:
value, type: any ,

A value to be checked.

trimString, type: boolean ,

(Optional) When this parameter is true, the method ignores whitespace characters at the beginning and end of a string value. Pass false to disable this functionality.

Implemented in:
Base

Specifies whether to keep values that cannot be assigned to questions, for example, choices unlisted in the choices array.

This property cannot be specified in the survey JSON schema. Use dot notation to specify it.

Type:
boolean writable
Implemented in:
SurveyModel
See also:
clearIncorrectValues

Specifies whether to enable lazy rendering.

In default mode, a survey renders the entire current page. With lazy rendering, the survey renders the page gradually as a user scrolls it. This helps reduce survey startup time and optimizes large surveys for low-end devices.

Default value: false

View Demo

Type:
boolean writable
Implemented in:
SurveyModel
See also:
settings.lazyRender

HTML content displayed while a survey JSON schema is being loaded.

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
See also:
processedLoadingHtml
Type:
(surveyId?: string, clientId?: string) => void
Parameters:

surveyId, type: string

clientId, type: string

Implemented in:
SurveyModel

An image URL or a Base64-encoded image to use as a survey logo.

View Demo

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
See also:
logoPosition * , logoFit

Specifies how to resize a logo to fit it into its container.

Possible values:

Refer to the object-fit CSS property description for information on the possible values.

View Demo

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
contain
Accepted values:
none , contain , cover , fill
Implemented in:
SurveyModel
See also:
logo * , logoPosition

A logo position relative to the survey title.

Possible values:

View Demo

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
left
Accepted values:
none , left , right , top , bottom
Implemented in:
SurveyModel
See also:
logo * , logoFit

A logo width in CSS-accepted values.

Default value: auto (the width is calculated automatically based on the logoHeight value to keep the original aspect ratio)

View Demo

Type:
any writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
auto
Implemented in:
SurveyModel
See also:
logo * , logoPosition * , logoFit

Specifies which part of a matrix row responds to a drag gesture in Dynamic Matrix questions.

Possible values:

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
entireItem
Accepted values:
entireItem , icon
Implemented in:
SurveyModel

Specifies the maximum text length in textual questions (Single-Line Input, Long Text, Multiple Textboxes), measured in characters.

Default value: 0 (unlimited)

You can override this setting for individual questions if you specify their maxLength property.

Type:
number writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
See also:
maxCommentLength
Type:
number writable
Implemented in:
SurveyModel

Merges a specified data object with the object from the data property.

Refer to the following help topic for more information: Populate Form Fields | Multiple Question Values.

Type:
(data: any) => void
Parameters:
data, type: any ,

A data object to merge. It should have the following structure: { questionName: questionValue, ... }

Implemented in:
SurveyModel
See also:
setValue
Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
edit
Accepted values:
edit , display
Implemented in:
SurveyModel

A URL to which respondents should be navigated after survey completion.

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
See also:
onNavigateToUrl * , navigateToUrlOnCondition

An array of objects that allows you to navigate respondents to different URLs after survey completion.

Each object should include the expression and url properties. When expression evaluates to true, the survey navigates to the corresponding url. Refer to the following help topic for more information about expressions: Expressions.

Type:
UrlConditionItem[] writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
See also:
onNavigateToUrl * , navigateToUrl

Gets or sets the position of the Start, Next, Previous, and Complete navigation buttons. Applies only if the showNavigationButtons property is true.

Possible values:

Type:
any writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
bottom
Accepted values:
top , bottom , topBottom
Implemented in:
SurveyModel
See also:
autoAdvanceEnabled * , showPrevButton * , showCompleteButton

Switches the survey to the next page.

This method returns a Boolean value that indicates whether the page was successfully switched. false is returned if the current page is the last page or if it contains validation errors.

Type:
() => boolean
Return Value:

true if the page was successfully switched; false otherwise.

Implemented in:
SurveyModel
See also:
isLastPage * , prevPage * , completeLastPage

Displays a toast notification with a specified message.

Depending on the type argument, a survey can display the following notification types:

Type:
(message: string, type: string, showActions?: boolean) => void
Parameters:
message, type: string ,

A message to display.

type, type: string ,

A notification type: "info" (default), "success", or "error".

showActions, type: boolean ,

For internal use.

Implemented in:
SurveyModel

An event that is raised after a cell in a Multi-Select Matrix or Dynamic Matrix is rendered to the DOM.

Parameters:

Type:
EventBase<SurveyModel, MatrixAfterCellRenderEvent>
Implemented in:
SurveyModel
See also:
onMatrixCellCreated

An event that is raised after a page is rendered to the DOM. Use it to modify page markup.

Parameters:

View Demo

Type:
EventBase<SurveyModel, AfterRenderPageEvent>
Implemented in:
SurveyModel

An event that is raised after a panel is rendered to the DOM. Use it to modify panel markup.

Parameters:

This event is raised for static Panels as well as panels within a Dynamic Panel.

Type:
EventBase<SurveyModel, AfterRenderPanelEvent>
Implemented in:
SurveyModel

An event that is raised after a question is rendered to the DOM. Use it to modify question markup.

Parameters:

View Demo

Type:
EventBase<SurveyModel, AfterRenderQuestionEvent>
Implemented in:
SurveyModel

An event that is raised after a question with a single input field is rendered to the DOM. Use it to modify question markup.

Parameters:

This event is not raised for questions without input fields (HTML, Image) or questions with multiple input fields (Matrix, Multiple Text).

Type:
EventBase<SurveyModel, AfterRenderQuestionInputEvent>
Implemented in:
SurveyModel

An event that is raised after the survey is rendered to the DOM. Use this event to modify survey markup.

Parameters:

View Demo

Type:
EventBase<SurveyModel, AfterRenderSurveyEvent>
Implemented in:
SurveyModel

An event that is raised to define whether a question answer is correct. Applies only to quiz surveys.

Parameters:

Type:
EventBase<SurveyModel, CheckAnswerCorrectEvent>
Implemented in:
SurveyModel

Use this event to load choice items in Dropdown and Tag Box questions on demand.

This event is raised only for those questions that have the choicesLazyLoadEnabled property set to true.

Parameters:

View Demo

Type:
EventBase<SurveyModel, ChoicesLazyLoadEvent>
Implemented in:
SurveyModel

An event that is raised after choices are loaded from a server but before they are assigned to a choice-based question, such as Dropdown or Checkboxes. Handle this event if you need to modify the loaded choices.

Parameters:

Type:
EventBase<SurveyModel, ChoicesLoadedEvent>
Implemented in:
SurveyModel

An event that is raised each time a search string in a Dropdown or Tag Box question changes. Use this event to implement custom filtering of choice options.

Parameters:

Type:
EventBase<SurveyModel, ChoicesSearchEvent>
Implemented in:
SurveyModel
See also:
QuestionDropdownModel.searchEnabled , QuestionDropdownModel.searchMode

An event that is raised when users clear files in a File Upload question or clear signature in a Signature Pad question. Use this event to delete files from your server.

Parameters:

File Upload Demo

Signature Pad Demo

Type:
EventBase<SurveyModel, ClearFilesEvent>
Implemented in:
SurveyModel
See also:
clearFiles * , onDownloadFile * , onUploadFiles

An event that is raised after the survey is completed. Use this event to send survey results to the server.

Parameters:

For an example of how to use the methods described above, refer to the following help topic: Store Survey Results in Your Own Database.

Do not disable the showCompletePage property if you call one of the options.showSave... methods. This is required because the UI that indicates data saving progress is integrated into the complete page. If you hide the complete page, the UI also becomes invisible.

Type:
EventBase<SurveyModel, CompleteEvent>
Implemented in:
SurveyModel
See also:
onPartialSend * , doComplete * , autoAdvanceAllowComplete

An event that is raised before the survey is completed. Use this event to prevent survey completion.

Parameters:

Type:
EventBase<SurveyModel, CompletingEvent>
Implemented in:
SurveyModel
See also:
onComplete * , doComplete * , autoAdvanceAllowComplete

An event that is raised when users add a custom choice option to a Single- or Multi-Select Dropdown question. Handle this event to save the choice option in a data storage.

Parameters:

To let users add their own choice options, enable the allowCustomChoices property for individual dropdown questions.

View Demo

Type:
EventBase<SurveyModel, CreateCustomChoiceItemEvent>
Implemented in:
SurveyModel

An event that is raised after the current page is switched.

Parameters:

View Demo

Type:
EventBase<SurveyModel, CurrentPageChangedEvent>
Implemented in:
SurveyModel
See also:
currentPageNo * , nextPage * , prevPage

An event that is raised before the current page is switched.

Parameters:

Type:
EventBase<SurveyModel, CurrentPageChangingEvent>
Implemented in:
SurveyModel
See also:
currentPageNo * , nextPage * , prevPage **

An event that is raised when a File Upload question starts to download a file. Use this event to implement file preview when your server stores only file names.

Parameters:

View Demo

Type:
EventBase<SurveyModel, DownloadFileEvent>
Implemented in:
SurveyModel
See also:
downloadFile * , onClearFiles * , onUploadFiles

An event that is raised when users drag and drop survey elements while designing the survey in Survey Creator. Use this event to control drag and drop operations.

Parameters:

Type:
EventBase<SurveyModel, DragDropAllowEvent>
Implemented in:
SurveyModel
See also:
isDesignMode

An event that is raised after a new panel is added to a Dynamic Panel question.

Parameters:

Type:
EventBase<SurveyModel, DynamicPanelModifiedEvent>
Implemented in:
SurveyModel

An event that is raised after the current panel is changed in a Dynamic Panel question.

Parameters:

Type:
EventBase<SurveyModel, DynamicPanelCurrentIndexChangedEvent>
Implemented in:
SurveyModel

An event that is raised after a panel is deleted from a Dynamic Panel question.

Parameters:

Type:
EventBase<SurveyModel, DynamicPanelModifiedEvent>
Implemented in:
SurveyModel

An event that is raised before a panel is deleted from a Dynamic Panel question. Use this event to cancel the deletion.

Parameters:

Type:
EventBase<SurveyModel, DynamicPanelRemovingEvent>
Implemented in:
SurveyModel

An event that is raised after a value is changed in a panel within a Dynamic Panel question.

Parameters:

Type:
EventBase<SurveyModel, DynamicPanelItemValueChangedEvent>
Implemented in:
SurveyModel

An event that is raised before a value is changed in a panel within a Dynamic Panel question.

Parameters:

Type:
EventBase<SurveyModel, DynamicPanelValueChangingEvent>
Implemented in:
SurveyModel

An event that is raised when an element within a panel gets focus.

Parameters:

Type:
EventBase<SurveyModel, FocusInPanelEvent>
Implemented in:
SurveyModel
See also:
onFocusInQuestion * , autoFocusFirstQuestion * , focusQuestion

An event that is raised when an element (input field, checkbox, radio button) within a question gets focus.

Parameters:

Type:
EventBase<SurveyModel, FocusInQuestionEvent>
Implemented in:
SurveyModel
See also:
onFocusInPanel * , autoFocusFirstQuestion * , focusQuestion

Use this event to load a display text for the default choice item in Dropdown and Tag Box questions.

If you load choices from a server (use choicesByUrl or onChoicesLazyLoad), display texts become available only when data is loaded, which does not happen until a user opens the drop-down menu. However, a display text for a default choice item is required before that. In this case, you can load data individually for the default item within the onGetChoiceDisplayValue event handler.

Parameters:

View Demo

Type:
EventBase<SurveyModel, GetChoiceDisplayValueEvent>
Implemented in:
SurveyModel

An event that is raised before a Dynamic Panel renders tab titles. Use this event to change individual tab titles.

Parameters:

View Demo

Type:
EventBase<SurveyModel, DynamicPanelGetTabTitleEvent>
Implemented in:
SurveyModel

An event that is raised before an Expression question displays a value. Use this event to override the display value.

Parameters:

Type:
EventBase<SurveyModel, GetExpressionDisplayValueEvent>
Implemented in:
SurveyModel

An event that allows you to add, delete, or modify actions in rows of a Dynamic Matrix.

Parameters:

View Demo

Type:
EventBase<SurveyModel, GetMatrixRowActionsEvent>
Implemented in:
SurveyModel
See also:
IAction

An event that is raised before the survey calculates a page number. Handle this event to modify page numbers.

This event is raised only if the showPageNumbers property is enabled.

Parameters:

Type:
EventBase<SurveyModel, GetPageNumberEvent>
Implemented in:
SurveyModel
See also:
onGetQuestionTitle * , questionStartIndex

An event that allows you to add, delete, or modify actions in a page title.

Parameters:

View Demo

Type:
EventBase<SurveyModel, GetPageTitleActionsEvent>
Implemented in:
SurveyModel
See also:
IAction

An event that is raised before the survey calculates a panel number. Handle this event to modify panel numbers.

This event is raised only for the panels with a specified title and visible number.

Parameters:

Type:
EventBase<SurveyModel, GetPanelNumberEvent>
Implemented in:
SurveyModel

An event that allows you to add, delete, or modify actions in a panel title.

Parameters:

Type:
EventBase<SurveyModel, GetPanelTitleActionsEvent>
Implemented in:
SurveyModel
See also:
IAction

An event that is raised before the survey displays progress text. Handle this event to change the progress text in code.

Parameters:

Type:
EventBase<SurveyModel, GetProgressTextEvent>
Implemented in:
SurveyModel
See also:
showProgressBar * , progressBarLocation * , progressBarType

Use this event to change a question's display text.

Parameters:

Type:
EventBase<SurveyModel, GetQuestionDisplayValueEvent>
Implemented in:
SurveyModel

An event that is raised before the survey calculates a question number. Handle this event to modify question numbers.

Parameters:

If you want to hide question numbers, disable the showQuestionNumbers property.

Type:
EventBase<SurveyModel, GetQuestionNumberEvent>
Implemented in:
SurveyModel
See also:
onGetQuestionTitle * , questionStartIndex

An event that is raised before the survey displays a question title. Handle this event to modify question titles.

Parameters:

If you want to modify question numbers, handle the onGetQuestionNumber event.

Type:
EventBase<SurveyModel, GetQuestionTitleEvent>
Implemented in:
SurveyModel
See also:
requiredMark

An event that allows you to add, delete, or modify actions in a question title.

Parameters:

View Demo

Type:
EventBase<SurveyModel, GetQuestionTitleActionsEvent>
Implemented in:
SurveyModel
See also:
IAction

An event that is raised when the survey applies HTML tags to a survey, page, panel, and question title. Handle this event to change the HTML tag of individual titles.

Parameters:

If you want to specify HTML tags for all titles, use the titleTags object in global settings.

View Demo

Type:
EventBase<SurveyModel, GetTitleTagNameEvent>
Implemented in:
SurveyModel
See also:
onGetQuestionTitle * , onGetQuestionNumber

An event that is raised when an ItemValue property is changed.

Parameters:

Type:
Event<(sender: Base, options: any) => any, Base, any>
Implemented in:
Base

An event that is raised after a cell in a Multi-Select Matrix or Dynamic Matrix is created.

Parameters:

Type:
EventBase<SurveyModel, MatrixCellCreatedEvent>
Implemented in:
SurveyModel
See also:
onAfterRenderMatrixCell

An event that is raised before a cell in a Multi-Select Matrix or Dynamic Matrix is created. Use this event to change the type of individual matrix cells.

Parameters:

Type:
EventBase<SurveyModel, MatrixCellCreatingEvent>
Implemented in:
SurveyModel
See also:
onAfterRenderMatrixCell

An event that is raised for Multi-Select Matrix and Dynamic Matrix questions when they validate a cell value. Use this event to display a custom error message based on a condition.

Parameters:

Type:
EventBase<SurveyModel, MatrixCellValidateEvent>
Implemented in:
SurveyModel
See also:
onMatrixRowAdding

An event that is raised after a cell value is changed in a Multi-Select Matrix or Dynamic Matrix.

Parameters:

Type:
EventBase<SurveyModel, MatrixCellValueChangedEvent>
Implemented in:
SurveyModel
See also:
onMatrixRowAdding

An event that is raised before a cell value is changed in a Multi-Select Matrix or Dynamic Matrix. Use this event to change the cell value.

Parameters:

Type:
EventBase<SurveyModel, MatrixCellValueChangingEvent>
Implemented in:
SurveyModel
See also:
onMatrixRowAdding

An event that is raised after a new column is added to a Multi-Select Matrix or Dynamic Matrix.

Parameters:

Type:
EventBase<SurveyModel, MatrixColumnAddedEvent>
Implemented in:
SurveyModel

An event that is raised after the visibility of an expandable detail section is changed. This event can be raised for Multi-Select and Dynamic Matrix questions.

Parameters:

Type:
EventBase<SurveyModel, MatrixDetailPanelVisibleChangedEvent>
Implemented in:
SurveyModel

An event that is raised before rendering the Remove button in a row of a Dynamic Matrix. Use this event to hide the Remove button for individual matrix rows.

Parameters:

Type:
EventBase<SurveyModel, MatrixAllowRemoveRowEvent>
Implemented in:
SurveyModel
See also:
onMatrixRowRemoving * , onMatrixRowRemoved

An event that is raised after a new row is added to a Dynamic Matrix.

Parameters:

Type:
EventBase<SurveyModel, MatrixRowAddedEvent>
Implemented in:
SurveyModel

An event that is raised before a new row is added to a Dynamic Matrix.

Parameters:

Type:
EventBase<SurveyModel, MatrixBeforeRowAddedEvent>
Implemented in:
SurveyModel

An event that is raised after a row is deleted from a Dynamic Matrix.

Parameters:

Type:
EventBase<SurveyModel, MatrixRowRemovedEvent>
Implemented in:
SurveyModel
See also:
onMatrixRenderRemoveButton

An event that is raised before a row is deleted from a Dynamic Matrix. You can cancel row deletion and clear row data instead.

Parameters:

Type:
EventBase<SurveyModel, MatrixRowRemovingEvent>
Implemented in:
SurveyModel
See also:
onMatrixRenderRemoveButton

An event that is raised on adding a new item in Multiple Text question.

Parameters:

Type:
EventBase<SurveyModel, MultipleTextItemAddedEvent>
Implemented in:
SurveyModel

An event that is raised before the survey navigates to a specified URL. Use this event to change the URL or cancel the navigation.

Parameters:

Type:
EventBase<SurveyModel, NavigateToUrlEvent>
Implemented in:
SurveyModel
See also:
navigateToUrl * , navigateToUrlOnCondition

An event that is raised when a respondent opens a dialog window to select files.

Parameters:

Type:
EventBase<SurveyModel, OpenFileChooserEvent>
Implemented in:
SurveyModel
See also:
chooseFiles

An event that is raised when a new page is added to the survey.

Parameters:

Type:
EventBase<SurveyModel, PageAddedEvent>
Implemented in:
SurveyModel
See also:
PanelModel

An event that is raised after page visibility is changed.

Parameters:

Refer to the following help topic for information on how to implement conditional visibility: Conditional Visibility.

Type:
EventBase<SurveyModel, PageVisibleChangedEvent>
Implemented in:
SurveyModel

An event that is raised when a new panel is added to a page.

Parameters:

Type:
EventBase<SurveyModel, PanelAddedEvent>
Implemented in:
SurveyModel

An event that is raised after a panel is deleted from the survey.

Parameters:

Type:
EventBase<SurveyModel, PanelRemovedEvent>
Implemented in:
SurveyModel

An event that is raised after panel visibility is changed.

Parameters:

Refer to the following help topic for information on how to implement conditional visibility: Conditional Visibility.

Type:
EventBase<SurveyModel, PanelVisibleChangedEvent>
Implemented in:
SurveyModel

An event that is raised when the survey processes dynamic texts and any text in curly brackets. Use this event, for instance, to substitute parameters in a RESTful URL with real values when you load choices by URL.

Parameters:

Type:
EventBase<SurveyModel, ProcessDynamicTextEvent>
Implemented in:
SurveyModel

An event that is raised when a property of this SurveyJS object has changed.

Parameters:

If you need to add and remove property change event handlers dynamically, use the registerPropertyChangedHandlers and unregisterPropertyChangedHandlers methods instead.

Type:
EventBase<Base, any>
Implemented in:
Base

An event that is raised when a new question is added to a panel or page.

Parameters:

To use this event for questions loaded from JSON, create an empty survey model, add an event handler, and only then populate the model from the JSON object:

import { Model } from "survey-core";

const surveyJson = {
   // ...
};
// Create an empty model
const survey = new Model();
// Add an event handler
survey.onQuestionAdded.add((sender, options) => {
  //...
});
// Load the survey JSON schema
survey.fromJSON(surveyJson);
Type:
EventBase<SurveyModel, QuestionAddedEvent>
Implemented in:
SurveyModel
See also:
onQuestionCreated

An event that is raised when the survey creates any new object derived from Question.

In a survey, complex elements (Dynamic Matrix, Multiple Text, and Dynamic Panel) are composed of questions. Use this event to customize any question regardless of which survey element it belongs to.

Parameters:

To use this event for questions loaded from JSON, create an empty survey model, add an event handler, and only then populate the model from the JSON object:

import { Model } from "survey-core";

const surveyJson = {
   // ...
};
// Create an empty model
const survey = new Model();
// Add an event handler
survey.onQuestionCreated.add((sender, options) => {
  //...
});
// Load the survey JSON schema
survey.fromJSON(surveyJson);
Type:
EventBase<SurveyModel, QuestionCreatedEvent>
Implemented in:
SurveyModel
See also:
onQuestionAdded

An event that is raised after a question is deleted from the survey.

Parameters:

Type:
EventBase<SurveyModel, QuestionRemovedEvent>
Implemented in:
SurveyModel

An event that is raised after question visibility is changed.

Parameters:

Refer to the following help topic for information on how to implement conditional visibility: Conditional Visibility.

Type:
EventBase<SurveyModel, QuestionVisibleChangedEvent>
Implemented in:
SurveyModel

An event that is raised when the survey's width or height is changed.

Parameters:

Type:
EventBase<SurveyModel, ResizeEvent>
Implemented in:
SurveyModel

Use this event to validate data on your server.

Parameters:

View Demo

Type:
EventBase<SurveyModel, ServerValidateQuestionsEvent>
Implemented in:
SurveyModel
See also:
onValidateQuestion * , onValidatePanel * , isValidatingOnServer

An event that is raised before a choice item is displayed. Use this event to change the visibility of individual choice items in Checkboxes, Dropdown, Radio Button Group, and other similar question types.

Parameters:

Type:
EventBase<SurveyModel, ShowingChoiceItemEvent>
Implemented in:
SurveyModel

An event that is raised when the survey state changes to "running".

For information on event handler parameters, refer to descriptions within the interface.

View Demo

Type:
EventBase<SurveyModel, {}>
Implemented in:
SurveyModel
See also:
firstPageIsStartPage

An event that is raised to convert Markdown content to HTML.

Parameters:

View Demo

Type:
EventBase<SurveyModel, TextMarkdownEvent>
Implemented in:
SurveyModel

An event that is raised before rendering a choice item in Radio Button Group, Checkboxes and Rating Scale questions. Use it to override default CSS classes applied to choice items.

Parameters:

View Demo

Type:
EventBase<SurveyModel, UpdateChoiceItemCssEvent>
Implemented in:
SurveyModel
See also:
css

An event that is raised before rendering a page. Use it to override default page CSS classes.

Parameters:

View Demo

Type:
EventBase<SurveyModel, UpdatePageCssClassesEvent>
Implemented in:
SurveyModel
See also:
css

An event that is raised before rendering a standalone panel and panels within Dynamic Panel. Use it to override default panel CSS classes.

Parameters:

View Demo

Type:
EventBase<SurveyModel, UpdatePanelCssClassesEvent>
Implemented in:
SurveyModel
See also:
css

An event that is raised before rendering a question. Use it to override default question CSS classes.

Parameters:

View Demo

Type:
EventBase<SurveyModel, UpdateQuestionCssClassesEvent>
Implemented in:
SurveyModel
See also:
css

An event that is raised when a File Upload or Signature Pad question starts to upload a file. Applies only if storeDataAsText is false. Use this event to upload files to your server.

Parameters:

File Upload Demo

Signature Pad Demo

Type:
EventBase<SurveyModel, UploadFilesEvent>
Implemented in:
SurveyModel
See also:
uploadFiles * , onDownloadFile * , onClearFiles

An event that is raised when a survey page is being validated. Use this event to add/remove/modify errors.

Parameters:

Type:
EventBase<SurveyModel, ValidatePageEvent>
Implemented in:
SurveyModel

An event that is raised when a panel is being validated. Use this event to add/remove/modify errors or specify a custom error message.

Parameters:

View Demo

Type:
EventBase<SurveyModel, ValidatePanelEvent>
Implemented in:
SurveyModel
See also:
onValidateQuestion * , onServerValidateQuestions

An event that is raised when a question value is being validated. Use this event to add/remove/modify errors or specify a custom error message.

Parameters:

View Demo

Type:
EventBase<SurveyModel, ValidateQuestionEvent>
Implemented in:
SurveyModel
See also:
onServerValidateQuestions * , onValidatePanel * , onMatrixCellValidate

An event that is raised after a question value is changed.

Parameters:

View Demo

To handle value changes in matrix cells or panels within a Dynamic Panel, use the onMatrixCellValueChanged or onDynamicPanelValueChanged event.

Type:
EventBase<SurveyModel, ValueChangedEvent>
Implemented in:
SurveyModel
See also:
setValue

An event that is raised before a question value is changed.

Parameters:

Type:
EventBase<SurveyModel, ValueChangingEvent>
Implemented in:
SurveyModel
See also:
setValue

An event that is raised after a variable or calculated value is changed.

Parameters:

Type:
EventBase<SurveyModel, VariableChangedEvent>
Implemented in:
SurveyModel
See also:
setVariable * , calculatedValues

Returns a total number of survey pages.

To get the number of visible pages, use the visiblePageCount property.

Type:
number readonly
Implemented in:
SurveyModel
See also:
pages

Gets or sets a caption for the Next button.

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
See also:
Localization & Globalization

Gets or sets a caption for the Previous button.

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
See also:
Localization & Globalization

Returns an array of all pages in the survey.

To get an array of only visible pages, use the visiblePages array.

Type:
PageModel[] readonly

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
See also:
PageModel

Specifies whether the preview of given answers includes all or only answered questions.

Possible values:

View Demo

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
allQuestions
Accepted values:
allQuestions , answeredQuestions
Implemented in:
SurveyModel

Gets or sets a caption for the Preview button.

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
See also:
showPreviewBeforeComplete * , showPreview * , editText

Switches the survey to the previous page.

This method returns a Boolean value that indicates whether the page was successfully switched. false is returned if the current page is the first page.

Type:
() => boolean
Return Value:

true if the page was successfully switched; false otherwise.

Implemented in:
SurveyModel
See also:
isFirstPage * , nextPage

Returns HTML content displayed to a user who has completed the survey before. To identify such users, the survey uses a cookie name.

To specify HTML content, use the completedBeforeHtml property.

Type:
string readonly
Implemented in:
SurveyModel

Returns HTML content displayed while a survey JSON schema is being loaded.

To specify HTML content, use the loadingHtml property.

Type:
string readonly
Implemented in:
SurveyModel

Specifies whether the progress bar spans the width of the survey or that of the survey container. Applies only when the progress bar is visible and progressBarType is "pages".

Possible values:

Type:
"survey" | "container" readonly

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
container
Accepted values:
container , survey
Implemented in:
SurveyModel
See also:
progressBarShowPageTitles * , progressBarShowPageNumbers

Specifies the alignment of the progress bar. Applies only if the showProgressBar property is true.

Possible values:

View Demo

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
auto
Accepted values:
auto , aboveheader , belowheader , bottom , topbottom
Implemented in:
SurveyModel
See also:
showProgressBar * , progressBarType * , progressValue

Specifies whether the progress bar displays page numbers. Applies only when the progress bar is visible and progressBarType is "pages".

Default value: false

View Demo

Type:
boolean readonly

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
See also:
progressBarShowPageTitles * , progressBarInheritWidthFrom

Specifies whether the progress bar displays page titles. Applies only when the progress bar is visible and progressBarType is "pages".

Default value: false

View Demo

Type:
boolean readonly

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
See also:
progressBarShowPageNumbers * , progressBarInheritWidthFrom

Specifies the type of information displayed by the progress bar. Applies only when showProgressBar is true.

Possible values:

When progressBarType is set to "pages", you can also enable the progressBarShowPageNumbers and progressBarShowPageTitles properties if you want to display page numbers and titles in the progress bar.

View Demo

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
pages
Accepted values:
pages , questions , requiredQuestions , correctQuestions
Implemented in:
SurveyModel
See also:
progressValue

Returns text displayed by the progress bar (for instance, "Page 2 of 3" or "Answered 3/8 questions"). Handle the onGetProgressText event to change this text.

Type:
string readonly
Implemented in:
SurveyModel
See also:
progressValue * , showProgressBar * , progressBarType

Specifies where to display question descriptions.

Possible values:

You can override this setting for individual questions if you specify their descriptionLocation property.

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
underTitle
Accepted values:
underInput , underTitle
Implemented in:
SurveyModel

Specifies the error message position.

Possible values:

You can override this setting if you specify the questionErrorLocation property for an individual page or panel or set the errorLocation property for a specific question.

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
top
Accepted values:
top , bottom
Implemented in:
SurveyModel

Specifies the sort order of questions in the survey.

Possible values:

You can override this property for individual pages and panels.

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
initial
Accepted values:
initial , random
Implemented in:
SurveyModel
See also:
PageModel.questionOrder * , PanelModel.questionOrder

Specifies how to distribute survey elements between pages.

Possible values:

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
standard
Accepted values:
standard , singlePage , questionPerPage , inputPerPage
Implemented in:
SurveyModel

Specifies the initial number or letter from which to start question numbering.

Question Numbers

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel

Gets or sets question title location relative to the input field: "top", "bottom", or "left".

Certain question types (Matrix, Multiple Text) do not support the "left" value. For them, the "top" value is used.

You can override this setting if you specify the questionTitleLocation property for an individual page or panel or set the titleLocation property for a specific question.

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
top
Accepted values:
top , bottom , left
Implemented in:
SurveyModel

Specifies a pattern for question titles.

Refer to the following help topic for more information: Title Pattern.

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
numTitleRequire
Implemented in:
SurveyModel

Enables the read-only mode. If you set this property to true, users cannot take the survey.

Default value: false

View Demo

Type:
boolean writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel

Registers a single value change handler for one or multiple properties.

The registerPropertyChangedHandlers and unregisterPropertyChangedHandlers methods allow you to manage property change event handlers dynamically. If you only need to attach an event handler without removing it afterwards, you can use the onPropertyChanged event instead.

Type:
(propertyNames: string[], handler: any, key?: string) => void
Parameters:
propertyNames, type: string[] ,

An array of one or multiple property names.

handler, type: any ,

A function to call when one of the listed properties change. Accepts a new property value as an argument.

key, type: string ,

(Optional) A key that identifies the current registration. If a function for one of the properties is already registered with the same key, the function will be overwritten. You can also use the key to subsequently unregister handlers.

Implemented in:
Base
See also:
unregisterPropertyChangedHandlers

Removes a page from the survey.

Pass a PageModel object to this method. You can get this object in different ways. For example, you can call the getPageByName() method to obtain a PageModel object with a specific name or use the currentPage property to access and delete the current page, as shown in the code below.

// Delete the current page
survey.removePage(survey.currentPage);
Type:
(page: PageModel) => void
Parameters:
page, type: PageModel ,

A page to remove.

Implemented in:
SurveyModel
See also:
addNewPage

Specifies one or multiple characters that designate required questions.

Default value: *

View Demo

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
*
Implemented in:
SurveyModel
Type:
string writable
Implemented in:
SurveyModel

Calculates a given expression and returns true or false.

Type:
(expression: string) => boolean
Parameters:
expression, type: string ,

An expression to calculate.

Implemented in:
SurveyModel

Calculates a given expression and returns a result value.

Type:
(expression: string, callback?: (res: any) => void) => any
Parameters:
expression, type: string ,

An expression to calculate.

callback, type: (res: any) => void ,

A callback function that you can use to access the calculation result if the expression uses asynchronous functions.

Implemented in:
SurveyModel
Type:
(postId?: string, clientId?: string, isPartial?: boolean) => void
Parameters:

postId, type: string

clientId, type: string

isPartial, type: boolean

Implemented in:
SurveyModel
Type:
boolean writable
Implemented in:
SurveyModel

Sets a cookie with a specified cookieName in the browser. If the cookieName property value is defined, this method is automatically called on survey completion.

Type:
() => void
Implemented in:
SurveyModel
See also:
hasCookie * , deleteCookie

Assigns a new value to a specified property.

Type:
(name: string, val: any) => void
Parameters:
name, type: string ,

A property name.

val, type: any ,

A new value for the property.

Implemented in:
Base

Sets a question value (answer).

View Demo

This method executes all triggers and reevaluates conditions (visibleIf, requiredId, and others). It also switches the survey to the next page if the autoAdvanceEnabled property is enabled and all questions on the current page have correct answers.

Type:
(name: string, newQuestionValue: any, locNotification?: any, allowNotifyValueChanged?: boolean, questionName?: string) => void
Parameters:
name, type: string ,

A question name.

newQuestionValue, type: any

locNotification, type: any ,

For internal use.

allowNotifyValueChanged, type: boolean ,

For internal use.

questionName, type: string

Implemented in:
SurveyModel
See also:
data * , getValue
Type:
boolean writable
Implemented in:
SurveyModel

Specifies whether to show the complete page.

Type:
boolean writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
True
Implemented in:
SurveyModel
See also:
onComplete * , navigateToUrl

Specifies whether to show all survey elements, regardless of their visibility.

Default value: false

Type:
boolean writable
Implemented in:
SurveyModel

Specifies whether page titles contain page numbers.

View Demo

Type:
boolean writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
See also:
onGetPageNumber

Specifies whether to display page titles.

Type:
boolean writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
True
Implemented in:
SurveyModel

Specifies whether to display the Previous button. Set this property to false if respondents should not move backward along the survey.

Type:
boolean writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
True
Implemented in:
SurveyModel
See also:
showNavigationButtons * , showCompleteButton

Specifies whether to show a preview of given answers before they are submitted.

Default value: false

View Demo

Type:
any writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
See also:
previewMode * , showPreview * , cancelPreview

Specifies whether to display survey element numbers and how to calculate them.

Possible values:

View Demo

If you want to hide the number of an individual question, disable its showNumber property.

Type:
string | boolean writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
off
Accepted values:
on , onPage , recursive , off
Implemented in:
SurveyModel
See also:
onGetQuestionNumber

Specifies the timer's visibility. Applies only to quiz surveys.

Default value: false

If you set this property to true, the timer starts automatically when the survey begins. To specify time limits, use the timeLimit and timeLimitPerPage properties.

View Demo

The timer displays information about time spent on an individual page and the entire survey. If you want to display only the page timer or the survey timer, set the timerInfoMode property to "page" or "survey".

You can enable the timer without displaying it. In this case, you need to specify the required time limits and use the startTimer() and stopTimer() methods to control the timer.

Type:
boolean writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
See also:
timerLocation * , timeSpent * , onTimerTick
Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel

Specifies whether to display the survey title.

View Demo

Type:
boolean writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
True
Implemented in:
SurveyModel
See also:
title

Gets or sets the visibility of the table of contents.

Default value: false

View Demo

Type:
boolean writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
See also:
tocLocation

Obsolete. Use the startPage property instead.

Type:
PageModel readonly
Implemented in:
SurveyModel

Returns the start page. Applies only if the firstPageIsStartPage property is set to true.

Refer to the following help topic for more information: Start Page.

Type:
PageModel readonly
Implemented in:
SurveyModel
See also:
firstPageIsStartPage * , activePage

Gets or sets a caption for the Start button.

View Demo

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
See also:
firstPageIsStartPage * , Localization & Globalization

Returns the current survey state.

Possible values:

Type:
string readonly
Implemented in:
SurveyModel
Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
Type:
boolean writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel

Specifies when to update the question value in questions with a text input field.

Possible values:

View Demo

Do not use the "onTyping" mode if your survey contains many expressions. Expressions are re-evaluated each time a question value is changed. In "onTyping" mode, the question value changes frequently. This may cause performance degradation.

You can override this setting for individual questions: textUpdateMode.

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
onBlur
Accepted values:
onBlur , onTyping
Implemented in:
SurveyModel

A time period that a respondent has to complete the survey; measured in seconds. Applies only to quiz surveys.

Default value: 0 (time is unlimited)

View Demo

Type:
number writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
See also:
timeLimitPerPage * , startTimer * , timeSpent

A time period that a respondent has to complete each survey page; measured in seconds. Applies only to quiz surveys.

Default value: 0 (time is unlimited)

You can also use PageModel's timeLimit property to specify a time period for an individual survey page.

View Demo

Type:
number writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
See also:
timeLimit * , startTimer * , timeSpent

Specifies whether the timer panel displays timers for the current page, the entire survey, or both. Applies only if the timer panel is visible.

Possible values:

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
combined
Accepted values:
page , survey , combined
Implemented in:
SurveyModel
See also:
timeSpent * , onTimerTick * , startTimer * , stopTimer

Specifies the timer's position relative to the survey. Applies only if the showTimer property is set to true.

Possible values:

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
top
Accepted values:
top , bottom
Implemented in:
SurveyModel
See also:
onTimerTick

A time period that a respondent has spent on the survey so far; measured in seconds. Applies only to quiz surveys.

Assign a number to this property if you need to start the quiz timer from a specific time (for instance, if you want to continue an interrupted quiz).

You can also find out how many seconds a respondent has spent on an individual survey page. To do this, use the timeSpent property of a PageModel object.

Type:
number writable
Implemented in:
SurveyModel
See also:
timeLimit * , timeLimitPerPage * , startTimer

A title for the survey element. If title is undefined, the name property value is displayed instead.

Empty pages and panels do not display their titles or names.

Type:
string writable
Implemented in:
SurveyElementCore
See also:
Configure Question Titles

Gets or sets the position of the table of contents. Applies only when the table of contents is visible.

Possible values:

View Demo

Type:
"left" | "right" writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
left
Accepted values:
left , right
Implemented in:
SurveyModel
See also:
showTOC

Returns a JSON schema that corresponds to the current survey element.

Type:
(options?: ISaveToJSONOptions) => any
Parameters:
options, type: ISaveToJSONOptions ,

An object with configuration options.

options.storeDefaults, type: boolean ,

Pass true if the JSON schema should include properties with default values.

Return Value:

A JSON schema of the survey element.

Implemented in:
Base
See also:
fromJSON

Completes the survey if it currently displays the last page and the page contains no validation errors. If both these conditions are met, this method returns true; otherwise, false.

If you want to complete the survey regardless of the current page and validation errors, use the doComplete() event.

Type:
() => boolean
Implemented in:
SurveyModel
See also:
isCurrentPageValid * , nextPage

Unregisters value change event handlers for the specified properties.

Type:
(propertyNames: string[], key?: string) => void
Parameters:
propertyNames, type: string[] ,

An array of one or multiple property names.

key, type: string ,

(Optional) A key of the registration that you want to cancel.

Implemented in:
Base
See also:
registerPropertyChangedHandlers

Uploads files to a server.

The following code shows how to call this method:

const question = survey.getQuestionByName("myFileQuestion");
survey.uploadFiles(
  question,
  question.name,
  question.value,
  (data, errors) => {
    // ...
  }
);
Type:
(question: QuestionFileModel | QuestionSignaturePadModel, name: string, files: any[], callback: (data: any, errors?: any) => any) => void
Parameters:
name, type: string ,

The File Upload question's name or Signature Pad question's name.

files, type: any[] ,

An array of JavaScript File objects that represent files to upload.

callback, type: (data: any, errors?: any) => any ,

A callback function that allows you to access successfully uploaded files as the first argument. If any files fail to upload, the second argument contains an array of error messages.

Implemented in:
SurveyModel
See also:
onUploadFiles * , downloadFile

Validates all questions and returns false if the validation fails.

If you use validation expressions and at least one of them calls an async function, the validate method returns undefined. In this case, you should pass a callback function as the onAsyncValidation parameter. The function's hasErrors Boolean parameter will contain the validation result.

Type:
(fireCallback?: boolean, focusFirstError?: boolean, onAsyncValidation?: (hasErrors: boolean) => void, changeCurrentPage?: boolean) => boolean
Parameters:
fireCallback, type: boolean ,

(Optional) Pass false if you do not want to show validation errors in the UI.

focusFirstError, type: boolean ,

(Optional) Pass true if you want to focus the first question with a validation error. The survey will be switched to the page that contains this question if required.

onAsyncValidation, type: (hasErrors: boolean) => void ,

(Optional) Pass a callback function. It accepts a Boolean hasErrors parameter that equals true if the validation fails or false otherwise.

changeCurrentPage, type: boolean

Implemented in:
SurveyModel
See also:
validateCurrentPage * , validatePage

Validates all questions on the current page and returns false if the validation fails.

If you use validation expressions and at least one of them calls an async function, the validateCurrentPage method returns undefined. In this case, you should pass a callback function as the onAsyncValidation parameter. The function's hasErrors Boolean parameter will contain the validation result.

Type:
(onAsyncValidation?: (hasErrors: boolean) => void) => boolean
Parameters:
onAsyncValidation, type: (hasErrors: boolean) => void ,

(Optional) Pass a callback function. It accepts a Boolean hasErrors parameter that equals true if the validation fails or false otherwise.

Implemented in:
SurveyModel
See also:
currentPage * , validate * , validateCurrentPage

Validates all questions on a specified page and returns false if the validation fails.

If you use validation expressions and at least one of them calls an async function, the validatePage method returns undefined. In this case, you should pass a callback function as the onAsyncValidation parameter. The function's hasErrors Boolean parameter will contain the validation result.

Type:
(page?: PageModel, onAsyncValidation?: (hasErrors: boolean) => void) => boolean
Parameters:
page, type: PageModel ,

Pass the PageModel that you want to validate. You can pass undefined to validate the activePage.

onAsyncValidation, type: (hasErrors: boolean) => void ,

(Optional) Pass a callback function. It accepts a Boolean hasErrors parameter that equals true if the validation fails or false otherwise.

Implemented in:
SurveyModel
See also:
validate * , validateCurrentPage

Specifies whether respondents can end a survey with validation errors.

Default value: false

Type:
boolean readonly
Implemented in:
SurveyModel
See also:
checkErrorsMode

Specifies whether respondents can switch the current page even if it contains validation errors.

Default value: false

Type:
boolean readonly
Implemented in:
SurveyModel
See also:
checkErrorsMode

Returns the number of visible survey pages.

To get a total number of survey pages, use the pageCount property.

Type:
number readonly
Implemented in:
SurveyModel
See also:
visiblePages * , Conditional Visibility

Returns an array of visible pages without the start page.

To get an array of all pages, use the pages property. If all pages are visible, the pages and visiblePages arrays are identical.

Type:
PageModel[] readonly
Implemented in:
SurveyModel
See also:
Conditional Visibility

A survey width in CSS values.

Default value: undefined (the survey inherits the width from its container)

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Implemented in:
SurveyModel
See also:
onResize

Specifies how to calculate the survey width.

Possible values:

Type:
string writable

This property is stored in the survey JSON definition and can be edited in the Survey Creator.

Default value:
auto
Accepted values:
auto , static , responsive
Implemented in:
SurveyModel

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4