Documentation Docs
Documentation Docs

QuestionPanelDynamicModel

A class that describes the Dynamic Panel question type.

Dynamic Panel allows respondents to add panels based on a panel template and delete them. Specify the templateElements property to configure panel template elements.

View Demo

Inherited from the following class(es):

addPanel method

Adds a new panel based on the template.

Type:
(index?: number) => PanelModel
Parameters:
index, type: number ,

(Optional) An index at which to insert the new panel. undefined adds the panel to the end or inserts it after the current panel if displayMode is "tab". A negative index (for instance, -1) adds the panel to the end in all cases, regardless of the displayMode value.

Implemented in:
QuestionPanelDynamicModel
See also:
panelCount * , panels * , allowAddPanel * , newPanelPosition
addPanelUI method

Adds a new panel based on the template.

Unlike the addPanel() method, addPanelUI() performs additional actions: checks whether a new panel can be added, expands and focuses the new panel, and runs animated effects.

Type:
() => PanelModel
Implemented in:
QuestionPanelDynamicModel
See also:
panelCount * , panels
allowAddPanel property

Specifies whether users are allowed to add new panels.

Default value: true

By default, users add new panels to the end. If you want to let users insert a new panel after the current panel, set the newPanelPosition property to "next".

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:
QuestionPanelDynamicModel
See also:
canAddPanel * , allowRemovePanel
allowRemovePanel property

Specifies whether users are allowed to delete panels.

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:
QuestionPanelDynamicModel
See also:
canRemovePanel * , allowAddPanel
canAddPanel property

Indicates whether it is possible to add a new panel.

This property returns true when all of the following conditions apply:

  • Users are allowed to add new panels (allowAddPanel is true).
  • Dynamic Panel or its parent survey is not in read-only state.
  • panelCount is less than maxPanelCount.
Type:
boolean readonly
Implemented in:
QuestionPanelDynamicModel
See also:
allowAddPanel * , isReadOnly * , panelCount * , maxPanelCount * , canRemovePanel
canRemovePanel property

Indicates whether it is possible to delete panels.

This property returns true when all of the following conditions apply:

  • Users are allowed to delete panels (allowRemovePanel is true).
  • Dynamic Panel or its parent survey is not in read-only state.
  • panelCount exceeds minPanelCount.
Type:
boolean readonly
Implemented in:
QuestionPanelDynamicModel
See also:
allowRemovePanel * , isReadOnly * , panelCount * , minPanelCount * , canAddPanel
clearErrors method

Empties the errors array.

Type:
() => void
Implemented in:
Question
See also:
errors
clearIfInvisible property

Specifies when to clear the question value if the question becomes invisible.

Possible values:

  • "default" (default) - Inherits the setting from the Survey's clearInvisibleValues property.
  • "onHidden" - Clears the value when the question becomes invisible. If a question is invisible on startup and has an initial value, this value will be cleared when the survey is complete.
  • "onHiddenContainer" - Clears the value when the question or its container (page or panel) becomes invisible. If a question is invisible on startup and has an initial value, this value will be cleared when the survey is complete.
  • "onComplete" - Clears the value when the survey is complete.
  • "none" - Never clears the value of an invisible question.
Type:
string writable

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

Default value:
default
Accepted values:
default , none , onComplete , onHidden , onHiddenContainer
Implemented in:
Question
See also:
SurveyModel.clearInvisibleValues * , visible * , SurveyModel.onComplete

Removes values that cannot be assigned to this 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:
() => void
Implemented in:
Question
See also:
validate
clearValue method

Sets the question's value and comment properties to undefined.

Type:
(keepComment?: boolean) => void
Parameters:
keepComment, type: boolean
Implemented in:
Question
See also:
value * , comment
clone method

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

Type:
() => Base
Implemented in:
Base
collapse method

Collapses the survey element.

In collapsed state, the element displays only title and description.

Type:
() => void
Implemented in:
SurveyElement
See also:
title * , description * , state * , toggleState * , expand * , isCollapsed * , isExpanded
comment property

A comment to the selected question value. Enable the showCommentArea property to allow users to leave comments.

Type:
string writable
Implemented in:
Question
See also:
showCommentArea * , commentText

A placeholder for the comment area. Applies when the showCommentArea property is true.

Type:
string writable

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

Implemented in:
Question
See also:
showCommentArea * , comment * , commentText
commentText property

Specifies a caption displayed above the comment area. Applies when the showCommentArea property is true.

Type:
string writable

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

Implemented in:
Question
See also:
showCommentArea * , comment
confirmDelete property

Specifies whether to display a confirmation dialog when a respondent wants to delete a panel.

Type:
boolean writable

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

Implemented in:
QuestionPanelDynamicModel
See also:
confirmDeleteText

A message displayed in a confirmation dialog that appears when a respondent wants to delete a panel.

Type:
string writable

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

Implemented in:
QuestionPanelDynamicModel
See also:
confirmDelete
containsErrors property

Returns true if the survey element or its child elements have validation errors.

This property contains the result of the most recent validation. This result may be outdated. Call the validate method to get an up-to-date value.

Type:
boolean readonly
Implemented in:
SurveyElement
See also:
errors
correctAnswer property

A correct answer to this question. Specify this property if you want to create a quiz.

Type:
any writable

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

Implemented in:
Question
See also:
SurveyModel.getCorrectAnswerCount * , SurveyModel.getInCorrectAnswerCount
cssClasses property

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

Use the following events of the SurveyModel object to override CSS classes:

Type:
any readonly
Implemented in:
SurveyElement
currentIndex property

A zero-based index of the currently displayed panel.

When displayMode is "list" or Dynamic Panel is empty (panelCount is 0), this property contains -1.

Type:
number writable
Implemented in:
QuestionPanelDynamicModel
See also:
currentPanel * , panels * , panelCount * , displayMode
currentPanel property

A PanelModel object that is the currently displayed panel.

When displayMode is "list" or Dynamic Panel is empty (panelCount is 0), this property contains null.

Type:
PanelModel writable
Implemented in:
QuestionPanelDynamicModel
See also:
currentIndex * , panels * , panelCount * , displayMode

If it is not empty, then this value is set to every new panel, including panels created initially, unless the defaultValue is not empty

Type:
any writable

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

Implemented in:
QuestionPanelDynamicModel
See also:
defaultValue * , defaultValueFromLastPanel
defaultValue property

A default value for the question. Ignored for question types that cannot have a value (for example, HTML).

The default value is used as a question value in the following cases:

  • While the survey is being loaded from JSON.
  • The question is just added to the survey and does not yet have an answer.
  • The respondent left the answer empty.
Type:
any writable

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

Implemented in:
Question
See also:
defaultValueExpression

An expression used to calculate the defaultValue.

This expression applies until the question value is specified by an end user or programmatically.

An expression can reference other questions as follows:

  • {other_question_name}
  • {panel.other_question_name} (to access questions inside the same dynamic panel)
  • {row.other_question_name} (to access questions inside the same dynamic matrix or multi-column dropdown)

An expression can also include built-in and custom functions for advanced calculations. For example, if the defaultValue should be today's date, set the defaultValueExpression to "today()", and the corresponding built-in function will be executed each time the survey is loaded. Refer to the following help topic for more information: Built-In Functions.

View Demo

Type:
any writable

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

Implemented in:
Question
See also:
defaultValue * , setValueExpression

Specifies whether default values for a new panel should be copied from the last panel.

If you also specify defaultValue, it will be merged with the copied values.

Type:
boolean writable

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

Implemented in:
QuestionPanelDynamicModel
See also:
defaultValue
description property

Explanatory text displayed under the title.

Type:
string writable
Implemented in:
SurveyElementCore
See also:
hasDescription

Specifies where to display a question description.

Possible values:

  • "default" (default) - Inherits the setting from the Survey's questionDescriptionLocation property.
  • "underTitle" - Displays the description under the question title.
  • "underInput" - Displays the description under the interactive area.
Type:
string writable

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

Default value:
default
Accepted values:
default , underInput , underTitle
Implemented in:
Question
See also:
description * , hasDescription
displayMode property

Specifies how to display panels.

Possible values:

  • "list" (default) - Displays panels one under the other. View Demo
  • "carousel" - Displays panels in a carousel. Users can switch between panels using navigation buttons.
  • "tab" - Displays each panel within a tab. Use the templateTabTitle to specify a template for tab titles. View Demo
Type:
"list" | "carousel" | "tab" readonly

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

Default value:
list
Accepted values:
list , carousel , tab
Implemented in:
QuestionPanelDynamicModel
See also:
showProgressBar * , progressBarLocation
enableIf property

A Boolean expression. If it evaluates to false, this question becomes read-only.

A survey parses and runs all expressions on startup. If any values used in the expression change, the survey re-evaluates it.

Refer to the following help topic for more information: Conditional Visibility.

View Demo

Type:
string writable

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

Implemented in:
Question
See also:
readOnly * , isReadOnly
errorLocation property

Specifies the error message position. Overrides the questionErrorLocation property specified for the question's container (survey, page, or panel).

Possible values:

  • "default" (default) - Inherits the setting from the questionErrorLocation property specified for the question's container.
  • "top" - Displays error messages above questions.
  • "bottom" - Displays error messages below questions.
Type:
string writable

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

Default value:
default
Accepted values:
default , top , bottom
Implemented in:
Question
errors property

Validation errors. Call the validate() method to validate survey element data.

Type:
SurveyError[] writable
Implemented in:
SurveyElement
See also:
validate
expand method

Expands the survey element.

Type:
() => void
Implemented in:
SurveyElement
See also:
state * , toggleState * , collapse * , isCollapsed * , isExpanded
focus method

Moves focus to the input field of this question.

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

Pass true if you want to focus an input field with the first validation error. Default value: false (focuses the first input field). Applies to question types with multiple input fields.

scrollIfVisible, type: boolean
Implemented in:
Question
fromJSON method

Assigns a new configuration to the current SurveyJS object. This configuration is taken from a passed JSON object.

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

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

A JSON object with properties that you want to apply to the current SurveyJS object.

options, type: ILoadFromJSONOptions ,

An object with configuration options.

Implemented in:
Base
See also:
toJSON

Returns a display text that corresponds to the question value. For example, if you call this method for a Dropdown question, it returns an item text instead of an item value.

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

Applies when the question value is an object (in Matrix, Multiple Text, and similar questions). Pass true if not only values in the object should be display texts, but also keys. Default value: false.

value, type: any ,

Specify this parameter to get a display text for a specific value, not for the current question value. If the question value is an object, this parameter should be a similar object.

Implemented in:
Question
getLocale method

Returns the survey's locale.

If a default locale is used, this method returns an empty string. To get the applied locale in this case, use the following code:

import { surveyLocalization } from 'survey-core';
const defaultLocale = surveyLocalization.defaultLocale;
Type:
() => string
Implemented in:
SurveyElement
See also:
Localization & Globalization

Returns an array of questions nested within the current question. Use this method to obtain questions within Multiple Text, Dynamic Panel, and Matrix-like questions.

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

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

Return Value:

An array of nested questions.

Implemented in:
Question
getPlainData method

Returns the question value as an object in which the question name, title, value, and other parameters are stored as individual properties.

If the question can have more than one value (Matrix, Multiple Text), the 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.

Pass an object with the includeEmpty property set to false if you want to skip empty answers.

Type:
(options?: IPlainDataOptions) => IQuestionPlainData
Parameters:
options, type: IPlainDataOptions
Implemented in:
Question

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 title location calculated based on the question's titleLocation property and the questionTitleLocation property of the question's containers (survey, page, or panel).

Type:
() => string
Implemented in:
Question
See also:
titleLocation * , SurveyModel.questionTitleLocation
goToNextPanel method

Switches Dynamic Panel to the next panel. Returns true in case of success, or false if displayMode is "list" or the current panel contains validation errors.

Type:
() => boolean
Implemented in:
QuestionPanelDynamicModel
See also:
displayMode
goToPrevPanel method

Switches Dynamic Panel to the previous panel.

Type:
() => void
Implemented in:
QuestionPanelDynamicModel
hasDescription property

Returns true if the survey element has a description.

Type:
boolean readonly
Implemented in:
SurveyElementCore
See also:
description
hasInput property

Returns false if the question has no input fields (HTML, Image, and similar question types).

Type:
boolean readonly
Implemented in:
Question
See also:
hasSingleInput
hasSingleInput property

Returns false if the question has no input fields (HTML, Image) or has multiple input fields (Matrix, Multiple Text).

Type:
boolean readonly
Implemented in:
Question
See also:
hasInput
hasTitle property

Returns false if the titleLocation property is set to "hidden" or if the question cannot have a title (for example, an HTML question).

If the title property is undefined or set to an empty string, the hasTitle property returns true, because the question uses its name as a title in this case.

Type:
boolean readonly
Implemented in:
Question
See also:
title * , titleLocation
hideNumber property

Hides the question number from the title and excludes the question from numbering.

If you want to disable question numbering in the entire survey, set SurveyModel's showQuestionNumbers property to false.

Type:
boolean writable

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

Implemented in:
Question
See also:
SurveyModel.showQuestionNumbers
id property

A value to assign to the id attribute of the rendered HTML element. A default id is generated automatically.

Type:
string writable
Implemented in:
Question
indent property

Increases or decreases an indent of survey element content from the left edge. Accepts positive integer values and 0. Does not apply in the Default V2 theme.

Type:
number writable
Implemented in:
SurveyElement
See also:
rightIndent
inSurvey property

Returns true if the object is included in a survey.

This property may return false, for example, when you create a survey model dynamically.

Type:
boolean readonly
Implemented in:
Base
isAllowTitleLeft property

Returns true if the question can display its title to the left of the input field.

Type:
boolean readonly
Implemented in:
Question
See also:
titleLocation * , getTitleLocation * , hasTitle

Returns true if a question answer matches the correctAnswer property value.

View Demo

Type:
() => boolean
Implemented in:
Question
See also:
correctAnswer * , SurveyModel.getQuizQuestions
isCollapsed property

Returns true if the survey element is collapsed.

Type:
boolean readonly
Implemented in:
SurveyElement
See also:
state * , toggleState * , collapse * , expand * , isExpanded

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
isDesignMode property

Returns true if the survey is being designed in Survey Creator.

Type:
boolean readonly
Implemented in:
Base
isEmpty method

Returns true if the question value is an empty string, array, or object or if it equals undefined or null.

Type:
() => boolean
Implemented in:
Question
isExpanded property

Returns true if the survey element is expanded.

Type:
boolean readonly
Implemented in:
SurveyElement
See also:
state * , toggleState * , collapse * , expand * , isCollapsed

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

Type:
boolean readonly
Implemented in:
Base

Indicates whether the Next button is visible.

Type:
boolean readonly
Implemented in:
QuestionPanelDynamicModel
See also:
currentIndex * , currentPanel * , panelNextText
isPage property

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
isPanel property

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
isParentVisible property

Returns true if a parent element (page or panel) is visible.

Type:
boolean readonly
Implemented in:
Question

Indicates whether the Previous button is visible.

Type:
boolean readonly
Implemented in:
QuestionPanelDynamicModel
See also:
currentIndex * , currentPanel * , panelPrevText
isQuestion property

Returns true if the survey element is a question.

Type:
boolean readonly
Implemented in:
SurveyElementCore
isReadOnly property

Returns true if the survey element or its parent element is read-only.

If you want to switch a survey element to the read-only state based on a condition, specify the enableIf property. Refer to the following help topic for information: Conditional Visibility.

Type:
boolean readonly
Implemented in:
SurveyElement
See also:
readOnly
isRequired property

Makes the question required. If a respondent skips a required question, the survey displays a validation error.

Type:
boolean writable

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

Implemented in:
Question
See also:
requiredIf * , Data Validation
isSurvey property

Returns true if the element is a survey.

Type:
boolean readonly
Implemented in:
SurveyElementCore
isValueEmpty method

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
isVisible property

Returns true if the question is visible or the survey is currently in design mode.

If you want to display or hide a question based on a condition, specify the visibleIf property. Refer to the following help topic for information: Conditional Visibility.

Type:
boolean readonly
Implemented in:
Question
See also:
visibleIf * , visible * , isParentVisible

An error message displayed when users enter a duplicate value into a question that accepts only unique values (isUnique is set to true or keyName is specified).

A default value for this property is taken from a localization dictionary. Refer to the following help topic for more information: Localization & Globalization.

Type:
string writable

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

Implemented in:
QuestionPanelDynamicModel
See also:
keyName
keyName property

Specifies a key question. Set this property to the name of a question used in the template, and Dynamic Panel will display keyDuplicationError if a user tries to enter a duplicate value in this question.

Type:
string writable

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

Implemented in:
QuestionPanelDynamicModel
See also:
keyDuplicationError
maxPanelCount property

A maximum number of panels in Dynamic Panel. Users cannot add new panels if panelCount equals maxPanelCount.

Default value: 100 (inherited from settings.panel.maxPanelCount)

Type:
number writable

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

Default value:
100
Implemented in:
QuestionPanelDynamicModel
See also:
panelCount * , minPanelCount * , allowAddPanel
maxWidth property

Gets or sets maximum survey element width in CSS values.

Default value: "100%" (taken from settings.maxWidth)

Type:
string writable
Implemented in:
SurveyElement
See also:
minWidth * , renderWidth * , width
minPanelCount property

A minimum number of panels in Dynamic Panel. Users cannot delete panels if panelCount equals minPanelCount.

Default value: 0

Type:
number writable

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

Implemented in:
QuestionPanelDynamicModel
See also:
panelCount * , maxPanelCount * , allowRemovePanel
minWidth property

Gets or sets minimum survey element width in CSS values.

Default value: "300px" (taken from settings.minWidth)

Type:
string writable
Implemented in:
SurveyElement
See also:
maxWidth * , renderWidth * , width
name property

A survey element identifier.

Question names must be unique.

Type:
string writable
Implemented in:
SurveyElement
newPanelPosition property

Specifies the position of newly added panels.

Possible values:

  • "last" (default) - New panels are added to the end.
  • "next" - New panels are inserted after the current panel.
Type:
string writable

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

Default value:
last
Accepted values:
next , last
Implemented in:
QuestionPanelDynamicModel
See also:
allowAddPanel * , addPanel
no property

A question number or letter (depends on the questionStartIndex property of the question container (panel, page, or survey)).

When the question number, title, or the entire question is invisible, this property returns an empty string.

Type:
string readonly
Implemented in:
Question
See also:
SurveyModel.questionStartIndex * , hideNumber * , titleLocation * , visibleIf
noEntriesText property

A text displayed when Dynamic Panel contains no entries.

Type:
string writable

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

Implemented in:
QuestionPanelDynamicModel

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

Parameters:

  • sender: this
    A SurveyJS object whose property contains an array of ItemValue objects.
  • options.obj: ItemValue
    An ItemValue object.
  • options.propertyName: string
    The name of the property to which an array of ItemValue objects is assigned (for example, "choices" or "rows").
  • options.name: "text" | "value"
    The name of the changed property.
  • options.newValue: any
    A new value for the property.
Type:
Event<(sender: Base, options: any) => any, Base, any>
Implemented in:
Base

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

Parameters:

  • sender: this
    A SurveyJS object whose property has changed.
  • options.name: string
    The name of the changed property.
  • options.newValue: any
    A new value for the property.
  • options.oldValue: any
    An old value of the property. If the property is an array, oldValue contains the same array as newValue does.

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 the question's ready state has changed (expressions are evaluated, choices are loaded from a web resource specified by the choicesByUrl property, etc.).

Parameters:

  • sender: SurveyModel
    A survey instance that contains the question whose ready state has changed.
  • options.isReady: boolean
    Indicates whether the question is ready.
  • options.oldIsReady: boolean
    Indicates the previous ready state.
Type:
EventBase<Question, any>
Implemented in:
Question
page property

Returns a page to which the question belongs and allows you to move this question to a different page.

Type:
IPage writable

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

Implemented in:
Question
panelAddText property

A caption for the Add Panel button.

Type:
string writable

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

Implemented in:
QuestionPanelDynamicModel
panelCount property

The number of panels in Dynamic Panel.

Type:
number writable

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

Accepted values:
0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10
Implemented in:
QuestionPanelDynamicModel
See also:
minPanelCount * , maxPanelCount
panelNextText property

A caption for the Next button. Applies only if displayMode is different from "list".

Type:
string writable

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

Implemented in:
QuestionPanelDynamicModel
See also:
displayMode * , isNextButtonVisible
panelPrevText property

A caption for the Previous button. Applies only if displayMode is different from "list".

Type:
string writable

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

Implemented in:
QuestionPanelDynamicModel
See also:
displayMode * , isPrevButtonVisible

Specifies the location of the Delete Panel button relative to panel content.

Possible values:

  • "bottom" (default) - Displays the Delete Panel button below panel content.
  • "right" - Displays the Delete Panel button to the right of panel content.
Type:
string writable

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

Default value:
bottom
Accepted values:
bottom , right
Implemented in:
QuestionPanelDynamicModel
See also:
panelRemoveText
panelRemoveText property

A caption for the Delete Panel button.

Type:
string writable

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

Implemented in:
QuestionPanelDynamicModel
See also:
panelRemoveButtonLocation
panels property

An array of PanelModel objects created based on a panel template.

Type:
PanelModel[] readonly
Implemented in:
QuestionPanelDynamicModel
See also:
PanelModel * , template * , panelCount
panelsState property

Specifies whether users can expand and collapse panels. Applies if displayMode is "list" and the templateTitle property is specified.

Possible values:

  • "default" (default) - All panels are displayed in full and cannot be collapsed.
  • "expanded" - All panels are displayed in full and can be collapsed in the UI.
  • "collapsed" - All panels display only their titles and descriptions and can be expanded in the UI.
  • "firstExpanded" - Only the first panel is displayed in full; other panels are collapsed and can be expanded in the UI.
Type:
string writable

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

Default value:
default
Accepted values:
default , collapsed , expanded , firstExpanded
Implemented in:
QuestionPanelDynamicModel
See also:
displayMode * , templateTitle
parent property

Returns a survey element (panel or page) that contains the question and allows you to move this question to a different survey element.

Type:
IPanel writable
Implemented in:
Question
parentQuestion property

A Dynamic Panel, Dynamic Matrix, or Dropdown Matrix that includes the current question.

This property is null for standalone questions.

Type:
E readonly
Implemented in:
SurveyElement

Specifies the alignment of the progress bar relative to the currently displayed panel. Applies only if displayMode is "carousel".

Possible values:

  • "top" (default) - Displays the progress bar at the top of the current panel.
  • "bottom" - Displays the progress bar at the bottom of the current panel.
  • "topBottom" - Displays the progress bar at the top and bottom of the current panel.
Type:
"bottom" | "top" | "topBottom" readonly

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

Default value:
top
Accepted values:
top , bottom , topBottom
Implemented in:
QuestionPanelDynamicModel

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

Type:
number readonly
Implemented in:
Question
See also:
Create a Quiz , correctAnswer * , SurveyModel.getQuizQuestions
readOnly property

Makes the survey element read-only.

If you want to switch a survey element to the read-only state based on a condition, specify the enableIf property. Refer to the following help topic for information: Conditional Visibility.

Type:
boolean writable
Implemented in:
SurveyElement
See also:
isReadOnly

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
removePanel method

Deletes a panel from the panels array.

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

A PanelModel instance or zero-based panel index.

Implemented in:
QuestionPanelDynamicModel
See also:
addPanel
removePanelUI method

Deletes a panel from the panels array.

Unlike the removePanel() method, removePanelUI() performs additional actions: checks whether the panel can be removed and displays a confirmation dialog (if the confirmDelete property is enabled).

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

A PanelModel instance or zero-based panel index.

Implemented in:
QuestionPanelDynamicModel
See also:
addPanelUI
renderMode property

Obsolete. Use the displayMode property instead.

Type:
string writable

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

Default value:
list
Accepted values:
list , progressTop , progressBottom , progressTopBottom , tab
Implemented in:
QuestionPanelDynamicModel
renderWidth property

Returns a calculated width of the rendered survey element in CSS values.

Type:
string writable
Implemented in:
SurveyElement
See also:
width * , minWidth * , maxWidth

Specifies a custom error message for a required form field.

Type:
string writable

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

Implemented in:
Question
See also:
isRequired
requiredIf property

A Boolean expression. If it evaluates to true, this question becomes required.

A survey parses and runs all expressions on startup. If any values used in the expression change, the survey re-evaluates it.

Refer to the following help topic for more information: Conditional Visibility.

Type:
string writable

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

Implemented in:
Question
See also:
isRequired
requiredText property

Returns a character or text string that indicates a required question.

Type:
string readonly
Implemented in:
Question
See also:
SurveyModel.requiredText * , isRequired
resetValueIf property

A Boolean expression. If it evaluates to true, the question value is reset to default.

A survey parses and runs all expressions on startup. If any values used in the expression change, the survey re-evaluates it.

View Demo

Type:
string writable

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

Implemented in:
Question
See also:
setValueIf
rightIndent property

Increases or decreases an indent of survey element content from the right edge. Accepts positive integer values and 0. Does not apply in the Default V2 theme.

Type:
number writable
Implemented in:
SurveyElement
See also:
indent

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

An expression used to calculate the question value.

You can use setValueExpression as a standalone property or in conjunction with the setValueIf expression, in which case the calculated question value applies only when setValueIf evaluates to true.

View Demo

Type:
string writable

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

Implemented in:
Question
See also:
defaultValueExpression * , resetValueIf
setValueIf property

A Boolean expression. If it evaluates to true, the question value is set to a value calculated using the setValueExpression.

A survey parses and runs all expressions on startup. If any values used in the expression change, the survey re-evaluates it.

View Demo

Type:
string writable

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

Implemented in:
Question
See also:
resetValueIf
showCommentArea property

Specifies whether to display a comment area. Incompatible with the showOtherItem property.

Type:
boolean writable

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

Implemented in:
Question
See also:
comment * , commentText * , showOtherItem
showOtherItem property

Specifies whether to display the "Other" choice item. Incompatible with the showCommentArea property.

Type:
boolean writable
Implemented in:
Question
See also:
otherText * , otherItem * , otherErrorText * , showCommentArea * , settings.specialChoicesOrder
showProgressBar property

Specifies whether to display the progress bar. Applies only if displayMode is "carousel".

Default value: true

Type:
boolean readonly

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

Default value:
True
Implemented in:
QuestionPanelDynamicModel
See also:
progressBarLocation

Use this property to show/hide the numbers in titles in questions inside a dynamic panel. By default the value is "off". You may set it to "onPanel" and the first question inside a dynamic panel will start with 1 or "onSurvey" to include nested questions in dymamic panels into global survey question numbering.

Type:
string writable

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

Default value:
off
Accepted values:
off , onPanel , onSurvey
Implemented in:
QuestionPanelDynamicModel

Obsolete. Use the showProgressBar property instead.

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:
QuestionPanelDynamicModel
startWithNewLine property

Disable this property if you want to render the current question on the same line or row with the previous question or panel.

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:
Question
state property

Gets and sets the survey element's expand state.

Possible values:

  • "default" (default) - The survey element is displayed in full and cannot be collapsed in the UI.
  • "expanded" - The survey element is displayed in full and can be collapsed in the UI.
  • "collapsed" - The survey element displays only title and description and can be expanded in the UI.
Type:
string writable
Implemented in:
SurveyElement
See also:
toggleState * , collapse * , expand * , isCollapsed * , isExpanded
survey property

Returns the survey object.

Type:
ISurvey readonly
Implemented in:
SurveyElement

A placeholder for tab titles that applies when the templateTabTitle expression doesn't produce a meaningful value.

Default value: "New Panel" (taken from a localization dictionary)

Type:
string writable

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

Implemented in:
QuestionPanelDynamicModel
template property

A PanelModel object used as a template to create dynamic panels.

Type:
PanelModel readonly
Implemented in:
QuestionPanelDynamicModel
See also:
PanelModel * , templateElements * , templateTitle * , panels * , panelCount

A template for panel descriptions.

Type:
string writable

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

Implemented in:
QuestionPanelDynamicModel
See also:
template * , templateTitle * , templateElements * , panels * , panelCount
templateElements property

An array of questions and panels included in a panel template.

Type:
IElement[] readonly

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

Implemented in:
QuestionPanelDynamicModel
See also:
template * , panels * , panelCount

Specifies the error message position.

Possible values:

  • "default" (default) - Inherits the setting from the errorLocation property.
  • "top" - Displays error messages above questions.
  • "bottom" - Displays error messages below questions.
Type:
string writable

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

Default value:
default
Accepted values:
default , top , bottom
Implemented in:
QuestionPanelDynamicModel
templateTabTitle property

A template for tab titles. Applies when displayMode is "tab".

The template can contain the following placeholders:

  • {panelIndex} - A panel index within the collection of all panels. Starts with 1.
  • {visiblePanelIndex} - A panel index within the collection of visible panels. Starts with 1.

If you want to customize individual tab titles, handle SurveyModel's onGetDynamicPanelTabTitle event.

View Demo

Type:
string writable

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

Implemented in:
QuestionPanelDynamicModel
See also:
templateTitle * , tabTitlePlaceholder * , displayMode
templateTitle property

A template for panel titles.

The template can contain the following placeholders:

  • {panelIndex} - A panel index within the collection of all panels. Starts with 1.
  • {visiblePanelIndex} - A panel index within the collection of visible panels. Starts with 1.
Type:
string writable

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

Implemented in:
QuestionPanelDynamicModel
See also:
template * , templateDescription * , templateElements * , panels * , panelCount

Gets or sets the location of question titles relative to their input fields.

  • "default" (default) - Inherits the setting from the Dynamic Panel's titleLocation property, which in turn inherits the questionTitleLocation property value specified for the Dynamic Panel's container (page or survey).
  • "top" - Displays question titles above input fields.
  • "bottom" - Displays question titles below input fields.
  • "left" - Displays question titles to the left of input fields.
  • "hidden" - Hides question titles.
Type:
string writable

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

Default value:
default
Accepted values:
default , top , bottom , left
Implemented in:
QuestionPanelDynamicModel
See also:
titleLocation

A Boolean expression that is evaluated against each panel. If the expression evaluates to false, the panel becomes hidden.

A survey parses and runs all expressions on startup. If any values used in the expression change, the survey re-evaluates it.

Use the {panel} placeholder to reference the current panel in the expression.

Refer to the following help topic for more information: Conditional Visibility.

Type:
string writable

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

Implemented in:
QuestionPanelDynamicModel
See also:
visibleIf * , visiblePanels
title property

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
titleLocation property

Sets question title location relative to the input field. Overrides the questionTitleLocation property specified for the question's container (survey, page, or panel).

Possible values:

  • "default" (default) - Inherits the setting from the questionTitleLocation property specified for the question's container.
  • "top" - Displays the title above the input field.
  • "bottom" - Displays the title below the input field.
  • "left" - Displays the title to the left of the input field.
  • "hidden" - Hides the question title.

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

Type:
string writable

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

Default value:
default
Accepted values:
default , top , bottom , left , hidden
Implemented in:
Question
See also:
SurveyModel.questionTitleLocation * , getTitleLocation * , isAllowTitleLeft
toggleState method

Toggles the survey element's state between collapsed and expanded.

Type:
() => boolean
Implemented in:
SurveyElement
See also:
state * , collapse * , expand * , isCollapsed * , isExpanded
toJSON method

Returns a JSON object that corresponds to the current SurveyJS object.

Type:
(options?: ISaveToJSONOptions) => any
Parameters:
options, type: ISaveToJSONOptions
Implemented in:
Base
See also:
fromJSON

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

Specifies whether to use display names for question values in placeholders.

Default value: true

This property applies to questions whose values are defined as objects with the value and text properties (for example, choice items in Radiogroup, Checkbox, and Dropdown questions).

You can use question values as placeholders in the following places:

  • Survey element titles and descriptions
  • The html property of the HTML question

To use a question value as a placeholder, specify the question name in curly brackets: {questionName}. Refer to the following help topic for more information: Dynamic Texts - Question Values.

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:
Question
validate method

Validates this question and returns false if the validation fails.

Type:
(fireCallback?: boolean, rec?: any) => boolean
Parameters:
fireCallback, type: boolean ,

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

rec, type: any
Implemented in:
Question
See also:
Data Validation
validators property

Question validators.

Data Validation

Type:
SurveyValidator[] writable

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

Implemented in:
Question
value property

Gets or sets the question value.

The following table illustrates how the value type depends on the question type:

Question type Value type(s)
Checkboxes Array<string | number>
Dropdown string | number
Dynamic Matrix Array<object>
Dynamic Panel Array<object>
Expression string | number | boolean
File Upload File | Array<File>
HTML (no value)
Image (no value)
Image Picker Array<string | number>
Long Text string
Multi-Select Dropdown object
Multi-Select Matrix object
Multiple Textboxes Array<string>
Panel (no value)
Radio Button Group string | number
Ranking Array<string | number>
Rating Scale number | string
Signature string (base64-encoded image)
Single-Line Input string | number | Date
Single-Select Matrix object
Yes/No (Boolean) boolean | string
Type:
any writable
Implemented in:
Question
valueName property

Specifies an object property that should store the question value.

Refer to the Merge Question Values help topic for more information.

Type:
string writable

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

Implemented in:
Question
visible property

Gets or sets question visibility.

If you want to display or hide a question based on a condition, specify the visibleIf property. Refer to the following help topic for information: Conditional Visibility.

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:
Question
See also:
isVisible * , visibleIf
visibleIf property

A Boolean expression. If it evaluates to false, this question becomes hidden.

A survey parses and runs all expressions on startup. If any values used in the expression change, the survey re-evaluates it.

Refer to the following help topic for more information: Conditional Visibility.

Type:
string writable

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

Implemented in:
Question
See also:
visible * , isVisible
visibleIndex property

Returns the visible index of the question in the survey. It can be from 0 to all visible questions count - 1 The visibleIndex is -1 if the title is 'hidden' or hideNumber is true

Type:
number readonly
Implemented in:
Question
See also:
titleLocation * , hideNumber

Returns the number of visible panels in Dynamic Panel.

Type:
number readonly
Implemented in:
QuestionPanelDynamicModel
See also:
templateVisibleIf
visiblePanels property

An array of currently visible panels (PanelModel objects).

Type:
PanelModel[] readonly
Implemented in:
QuestionPanelDynamicModel
See also:
templateVisibleIf
width property

Sets survey element width in CSS values.

Default value: ""

Type:
string writable
Implemented in:
SurveyElement
See also:
minWidth * , maxWidth

Copyright © 2024 Devsoft Baltic OÜ. All rights reserved.

Your cookie settings

We use cookies on our site to make your browsing experience more convenient and personal. In some cases, they are essential to making the site work properly. By clicking "Accept All", you consent to the use of all cookies in accordance with our Terms of Use & Privacy Statement. However, you may visit "Cookie settings" to provide a controlled consent.

Your renewal subscription expires soon.

Since the license is perpetual, you will still have permanent access to the product versions released within the first 12 month of the original purchase date.

If you wish to continue receiving technical support from our Help Desk specialists and maintain access to the latest product updates, make sure to renew your subscription by clicking the "Renew" button below.

Your renewal subscription has expired.

Since the license is perpetual, you will still have permanent access to the product versions released within the first 12 month of the original purchase date.

If you wish to continue receiving technical support from our Help Desk specialists and maintain access to the latest product updates, make sure to renew your subscription by clicking the "Renew" button below.