Adds a survey element (question or panel) to this panel/page. Returns true
if the element was added successfully; false
otherwise.
A survey element to add.
index, type: number ,A desired index of this element in the elements
array.
Creates a new panel and adds it to the end of the elements
array.
This method returns null
if the panel cannot be created or added to this panel/page; otherwise, the method returns the created panel.
A panel name.
Creates a new question of a given type and adds it to the elements
array at a specified index.
This method returns null
if the question cannot be created or added to this panel/page; otherwise, the method returns the created question.
A question name.
index, type: number ,A desired index of the new question in the elements
array.
Returns true
if elements in this panel/page are arranged in random order.
Empties the errors
array for this panel/page and all its child elements (panels and questions).
Removes values that cannot be assigned to nested questions, 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 for invisible questions and values that fail validation. Call the
validate()
method to validate newly assigned values.
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
Checks whether a given element belongs to this panel/page or nested panels.
A survey element to check.
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 all survey elements (questions or panels) within this panel/page. Does not include questions within nested panels.
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 panel/page 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.
Validation errors. Call the validate()
method to validate survey element data.
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 JSON object with display texts that correspond to question values nested in the panel/page.
Pass true
if not only values in the object should be display texts, but also keys. Default value: false
.
Returns a survey element with a specified name
. This method can find survey elements within nested panels.
An element name.
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 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 a question with a specified name
. This method does not find questions within nested panels.
A question name.
Returns the object type as it is used in the JSON schema.
An array of columns used to arrange survey elements within this page or panel. Applies only if you set the SurveyModel
's gridLayoutEnabled
property to true
.
Each object in this array configures a single layout column and has the following properties:
width
: number
Column width, in percentage.
questionTitleWidth
: string
The width of question titles, in pixels.
The gridLayoutColumns
array is generated automatically based on the maximum number of questions and panels in the same row. To arrange the survey elements in one or several rows, disable the startWithNewLine
property for those elements that should occupy the same row as the previous question or panel. You can also set the colSpan
property for individual questions and panels to specify how many layout columns they span.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
An auto-generated unique element identifier.
Increases or decreases an indent of survey element content from the left edge. Accepts positive integer values and 0.
Increases or decreases an indent of panel content from the left edge. Accepts positive integer values and 0.
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
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 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 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 panel/page require an answer at least in one nested question. If a respondent leaves the panel/page without any answers, the survey displays a validation error.
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.
Returns true
if the panel/page 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.
A survey element identifier.
Question names must be unique.
A question number or letter (depends on the questionStartIndex
property).
When the question number, title, or the entire question is invisible, this property returns an empty string.
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.
Returns a page to which the panel belongs and allows you to move this panel 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 this panel and allows you to move the panel to a different survey element.
For PageModel
objects, the parent
property is null
, except 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 the parent
property contains this object.
A Dynamic Panel, Dynamic Matrix, or Dropdown Matrix that includes the current question.
This property is null
for standalone questions.
Specifies the error message position for questions that belong to this page/panel.
Use this property to override the questionErrorLocation
property specified for the survey. You can also set the errorLocation
property for individual questions.
Possible values:
"default"
(default) - Inherits the setting from the questionErrorLocation
property specified for the survey."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.
Specifies the sort order of questions in the panel/page.
Possible values:
"initial"
- Preserves the original order of questions."random"
- Displays questions in random order."default"
(default) - Inherits the setting from the SurveyModel
's questionOrder
property.This property is stored in the survey JSON definition and can be edited in the Survey Creator.
An array of all questions within this panel/page. Includes questions within nested panels.
Specifies a number or letter used to start numbering of elements inside the panel.
You can include desired prefixes and postfixes alongside the number or letter:
"questionStartIndex": "a.", // a., b., c., ...
"questionStartIndex": "#3", // #3, #4, #5, ...
"questionStartIndex": "(B)." // (B)., (C)., (D)., ...
Default value: "1."
(inherited from SurveyModel
's questionStartIndex
property)
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
Sets a title location relative to the input field for questions that belong to this panel/page.
Use this property to override the questionTitleLocation
property specified for the survey or parent page. You can also set the titleLocation
property for individual questions.
Possible values:
"default"
(default) - Inherits the setting from the questionTitleLocation
property specified for the survey or parent page."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.
Sets consistent width for question titles in CSS values. Applies only when questionTitleLocation
evaluates to "left"
.
Default value: undefined
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.
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.
Deletes a survey element (question or panel) from this panel/page. Returns true
if the element was deleted successfully; false
otherwise.
A survey element to delete.
Specifies a custom error message for a required panel/page.
A Boolean expression. If it evaluates to true
, this panel/page becomes required (at least one question in the panel/page should have an answer).
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.
Assigns a new value to a specified property.
A property name.
val, type: any ,A new value for the property.
Specifies whether to display survey element numbers within this page/panel and how to calculate them.
Possible values:
"default"
- Inherits the setting from the parent panel, page, or survey."recursive"
- Applies recursive numbering to elements nested within this page/panel (for example, 1 -> 1.1 -> 1.1.1, etc.)."onpanel"
- Starts numbering within this page/panel from scratch.false
or "off"
- Hides question numbers within this page/panel.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 panel 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.
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.
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.
Validates questions within this panel or page and returns false
if the validation fails.
(Optional) Pass false
if you do not want to show validation errors in the UI.
(Optional) Pass true
if you want to focus the first question with a validation error.
rec, type: any
Gets or sets panel/page visibility.
If you want to display or hide a survey element 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 panel/page 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 panel in the survey. Commonly it is -1 and it doesn't show. You have to set showNumber to true to show index/numbering for the Panel
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