Specifies whether to display a button that clears the selected value.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
Specifies whether users can add their own choices if the desired option isn't available in the dropdown.
Default value: false
Custom choices will only be stored temporarily for the duration of the current browser session. If you want to save them in a database or another data storage, handle the
onCreateCustomChoiceItem
event.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
Gets or sets choice items. This property accepts an array of objects with the following structure:
{
"value": any, // A unique value to be saved in the survey results.
"text": string, // A display text. This property supports Markdown. When `text` is undefined, `value` is used.
"imageLink": string // A link to the image or video that represents this choice value. Applies only to Image Picker questions.
"customProperty": any // Any property that you find useful.
}
To enable Markdown support for the text
property, implement Markdown-to-HTML conversion in the onTextMarkdown
event handler. For an example, refer to the following demo: Convert Markdown to HTML with markdown-it.
If you add custom properties, refer to the following help topic to learn how to serialize them into JSON: Add Custom Properties to Property Grid.
If you need to specify only the value
property, you can set the choices
property to an array of primitive values, for example, [ "item1", "item2", "item3" ]
. These values are both saved in survey results and used as display text.
Conditionally Display Choice Options
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
A Boolean expression that is evaluated against each choice item. If the expression evaluates to false
, the choice item 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.
Use the {item}
placeholder to reference the current choice item in the expression.
Refer to the following help topic for more information: Conditional Visibility.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
Specifies which choice items to copy from another question. Applies only when the choicesFromQuestion
property is specified.
Possible values:
"all"
(default) - Copies all choice items."selected"
- Copies only selected choice items."unselected"
- Copies only unselected choice items.Use the
visibleChoices
property to access copied choice items in code.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
Specifies the number of choice items to load at a time when choices are loaded on demand.
Default value: 25
This property does not accept values below 25 to prevent the server from being flooded with requests.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
Use the choicesMin
, choicesMax
, and choicesStep
properties to generate choice items automatically. For example, the configuration below generates three choice items: [10, 20, 30].
"choicesMin": 10,
"choicesMax": 30
"choicesStep": 10
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
Use the choicesMin
, choicesMax
, and choicesStep
properties to generate choice items automatically. For example, the configuration below generates three choice items: [10, 20, 30].
"choicesMin": 10,
"choicesMax": 30
"choicesStep": 10
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
Specifies the sort order of choice items.
Possible values:
"none"
(default) - Preserves the original order of choice items."asc"
- Sorts choice items in ascending order."desc"
- Sorts choice items in ascending order."random"
- Displays choice items in random order.This property is stored in the survey JSON definition and can be edited in the Survey Creator.
Use the choicesMin
, choicesMax
, and choicesStep
properties to generate choice items automatically. For example, the configuration below generates three choice items: [10, 20, 30].
"choicesMin": 10,
"choicesMax": 30
"choicesStep": 10
The default value of the choicesStep
property is 1.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
A Boolean expression that is evaluated against each choice item. If the expression evaluates to false
, the choice item 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 {item}
placeholder to reference the current choice item in the expression.
Refer to the following help topic for more information: Conditional Visibility.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
Specifies which matrix column or dynamic panel question supplies choice texts. Use this property to construct choice items based on cell values in Dynamic Matrix and question values in Dynamic Panel.
Each choice item consists of a value saved in survey results and a text displayed in the UI. To construct a choice item, assign the name
of a Dynamic Matrix or Dynamic Panel to the choicesFromQuestion
property and specify which dynamic panel question or matrix column supplies values and which provides texts. Use the choiceValuesFromQuestion
and choiceTextsFromQuestion
properties for this purpose. If a choice text is empty, a choice value is used as a display text and saved in survey results.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
Specifies which matrix column or dynamic panel question supplies choice values. Use this property to construct choice items based on cell values in Dynamic Matrix and question values in Dynamic Panel.
Each choice item consists of a value saved in survey results and a text displayed in the UI. To construct a choice item, assign the name
of a Dynamic Matrix or Dynamic Panel to the choicesFromQuestion
property and specify which dynamic panel question or matrix column supplies values and which provides texts. Use the choiceValuesFromQuestion
and choiceTextsFromQuestion
properties for this purpose. If a choice text is empty, a choice value is used as a display text and saved in survey results.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
Empties the errors
array.
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.This property is stored in the survey JSON definition and can be edited in the Survey Creator.
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.
Sets the question's value
and comment
properties to undefined
.
keepComment, type: boolean
Creates a new object that has the same type and properties as the current SurveyJS object.
Specifies how many columns this survey element spans in the grid layout. Applies only if you set the SurveyModel
's gridLayoutEnabled
property to true
and define the gridLayoutColumns
array for the parent page or panel.
Default value: 1
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.
An array of choice items that were added by a user. Applies only if the allowCustomChoices
is set to true
for this question.
Custom choices will only be stored temporarily for the duration of the current browser session. If you want to save them in a database or another data storage, handle the
onCreateCustomChoiceItem
event.
A value to show in HTML questions and in the dynamic titles and descriptions of survey elements when the question value is empty.
Default value: ""
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
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:
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
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.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
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.This property is stored in the survey JSON definition and can be edited in the Survey Creator.
Returns the "Don't know" choice item. Use this property to change the item's value
or text
.
Gets or sets a caption for the "Don't know" choice item.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
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.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
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.This property is stored in the survey JSON definition and can be edited in the Survey Creator.
Validation errors. Call the validate()
method to validate survey element data.
Moves focus to the input field of this question.
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
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.
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.
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.
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
.
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.
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;
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.
A Boolean value that specifies whether to include only visible nested questions.
includeNested, type: boolean
includeItSelf, type: boolean
An array of nested questions.
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.
options, type: IPlainDataOptions
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
.
A property name.
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.
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
Returns title location calculated based on the question's titleLocation
property and the questionTitleLocation
property of the question's containers (survey, page, or panel).
Returns false
if the question has no input fields (HTML, Image, and similar question types).
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.
Specifies whether to hide the question if no choice items are visible.
This property is useful if you show or hide choice items at runtime based on a condition.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
A value to assign to the id
attribute of the rendered HTML element. A default id
is generated automatically.
Increases or decreases an indent of survey element content from the left edge. Accepts positive integer values and 0.
Use this method to find out if the current object is of a given typeName
or inherited from it.
One of the values listed in the getType() description.
true
if the current object is of a given typeName
or inherited from it.
Returns true
if the survey is being designed in Survey Creator.
Returns true
if the question value is an empty string, array, or object or if it equals undefined
or null
.
Returns true
if a passed choice item is selected.
To obtain a choice item to check, use the noneItem
or otherItem
property or the choices
array.
A choice item.
Returns true
if the object configuration is being loaded from JSON.
Returns true
if the survey element is a page.
This property returns false
for PageModel
objects in the following cases:
SurveyModel
's questionsOnPageMode
is set to "singlePage"
.In those cases, the survey creates an internal PageModel
object to show all questions on one page, and all regular pages become panels.
Returns true
if the survey element is a panel or acts as one.
This property returns true
for PageModel
objects in the following cases:
SurveyModel
's questionsOnPageMode
is set to "singlePage"
.In those cases, the survey creates an internal PageModel
object to show all questions on one page, and all regular pages become panels.
Returns true
if a parent element (page or panel) is visible.
Returns true
if the survey element is a question.
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.
Makes the question required. If a respondent skips a required question, the survey displays a validation error.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
Returns true
if the element is a survey.
Returns true
if a passed value
is an empty string, array, or object or if it equals to undefined
or null
.
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.
Specifies whether to keep values that cannot be assigned to this question, for example, choices unlisted in the choices
array.
This property cannot be specified in the survey JSON schema. Use dot notation to specify it.
A survey element identifier.
Question names must be unique.
Returns the "None" choice item. Use this property to change the item's value
or text
.
Gets or sets a caption for the "None" choice item.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
An event that is raised when an ItemValue
property is changed.
Parameters:
sender
: this
ItemValue
objects.options.obj
: ItemValue
ItemValue
object.options.propertyName
: string
ItemValue
objects is assigned (for example, "choices"
or "rows"
).options.name
: "text"
| "value"
options.newValue
: any
An event that is raised when a property of this SurveyJS object has changed.
Parameters:
sender
: this
options.name
: string
options.newValue
: any
options.oldValue
: any
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.
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
options.isReady
: boolean
options.oldIsReady
: boolean
Gets or sets an error message displayed when users select the "Other" choice item but leave the comment area empty.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
Returns the "Other" choice item. Use this property to change the item's value
or text
.
A placeholder for the comment area. Applies when the showOtherItem
or showCommentArea
property is true
.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
Gets or sets a caption for the "Other" choice item.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
Returns a page to which the question belongs and allows you to move this question to a different page.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
Returns a survey element (panel or page) that contains the question and allows you to move this question to a different survey element.
A Dynamic Panel, Dynamic Matrix, or Dropdown Matrix that includes the current question.
This property is null
for standalone questions.
A placeholder for the input field.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
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.
Returns the "Refuse to answer" choice item. Use this property to change the item's value
or text
.
Gets or sets a caption for the "Refuse to answer" choice item.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
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.
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.
Specifies a custom error message for a required form field.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
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.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
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.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
Specifies a comparison operation used to filter the drop-down list. Applies only if searchEnabled
is true
.
Possible values:
"contains"
(default)"startsWith"
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
Returns the selected choice item. If no item is selected, returns null
.
Assigns a new value to a specified property.
A property name.
val, type: any ,A new value for the property.
An expression that calculates the question value.
The setValueExpression
is re-evaluated whenever a referenced question's value changes. If you also specify the setValueIf
expression, re-evaluation occurs only when it returns true
.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
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.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
Specifies whether to show a number for this question. Setting this property to false
hides the question number from the title and excludes the question from numbering.
Default value: false
(inherited from the SurveyModel
's showQuestionNumbers
property)
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
Disable this property if you want to render the current question on the same line or row with the previous question or panel.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
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.Returns the survey object.
Specifies whether to wrap long texts in choice options onto a new line.
Default value: true
Disable this property if you want the texts to be truncated with ellipsis.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
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.
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.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
Returns a JSON schema that corresponds to the current survey element.
An object with configuration options.
options.storeDefaults, type: boolean ,Pass true
if the JSON schema should include properties with default values.
A JSON schema of the survey element.
Unregisters value change event handlers for the specified properties.
An array of one or multiple property names.
key, type: string ,(Optional) A key of the registration that you want to cancel.
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:
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.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
Validates this question and returns false
if the validation fails.
(Optional) Pass false
if you do not want to show validation errors in the UI.
rec, type: any
Question validators.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
Gets or sets the question value.
The following table illustrates how the value type depends on the question type:
Question type Value type(s) CheckboxesArray<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 Array<string | number>
Multi-Select Matrix object
Multiple Textboxes Array<string>
Panel (no value) Radio Button Group string
| number
Ranking Array<string | number>
Rating Scale number
| string
Slider Array<string | number>
Signature string
(base64-encoded image) Single-Line Input string
| number
| Date
Single-Select Matrix object
Yes/No (Boolean) boolean
| string
Specifies an object property that should store the question value.
Refer to the Merge Question Values help topic for more information.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
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.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
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.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
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 showNumber is false
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