|
Returns the currentPage, unless the started page is showing. In this case returns the started page.
- Type:
-
any readonly
- Implemented in:
-
SurveyModel
- See also:
-
currentPage *
, firstPageIsStarted *
, startedPage
|
|
Adds a custom navigation item similar to the Previous Page, Next Page, and Complete buttons.
Accepts an object described in the IAction help section.
View Demo
- Type:
-
(val: IAction) => Action
- Parameters:
-
val, type: IAction
- Implemented in:
-
SurveyModel
|
|
Creates a new page and adds it to a survey. Generates a new name if the name parameter is not specified.
- Type:
-
(name?: string, index?: number) => PageModel
- Parameters:
-
name, type: string
, a page name
index, type: number
,
- a page index to where insert a new page. It is -1 by default and the page will be added into the end.
- Implemented in:
-
SurveyModel
- See also:
-
addPage
|
|
Adds an existing page to the survey.
- Type:
-
(page: PageModel, index?: number) => void
- Parameters:
-
page, type: PageModel
, a newly added page
index, type: number
,
- a page index to where insert a page. It is -1 by default and the page will be added into the end.
- Implemented in:
-
SurveyModel
- See also:
-
addNewPage
|
|
Gets or sets whether a survey is automatically completed when goNextPageAutomatic = true . Set it to false if you do not want to submit survey automatically on completing the last survey page.
- Type:
-
boolean writable
- Implemented in:
-
SurveyModel
- See also:
-
goNextPageAutomatic
|
|
Gets or sets a list of calculated values in the survey.
- Type:
-
CalculatedValue[] writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
- See also:
-
Calculated Values
|
|
Cancels preview and switches back to the "running" state.
Details: Preview State
- Type:
-
(curPage?: any) => void
- Parameters:
-
curPage, type: any
,
- A new current page. If the parameter is undefined then the last page becomes the current.
- Implemented in:
-
SurveyModel
- See also:
-
showPreviewBeforeComplete *
, showPreview *
, state
|
|
Gets or sets a value that specifies how the survey validates the question answers.
The following options are available:
onNextPage (default) - check errors on navigating to the next page or on completing the survey.
onValueChanged - check errors on every question value (i.e., answer) changing.
onValueChanging - check errors before setting value into survey. If there is an error, then survey data is not changed, but question value will be keeped.
onComplete - to validate all visible questions on complete button click. If there are errors on previous pages, then the page with the first error becomes the current.
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Default value:
- onNextPage
- Accepted values:
-
onNextPage
, onValueChanged
, onValueChanging
, onComplete
- Implemented in:
-
SurveyModel
|
|
Clears the survey data and state. If the survey has a completed state, it will get a running state.
- Type:
-
(clearData?: boolean, gotoFirstPage?: boolean) => void
- Parameters:
-
clearData, type: boolean
, clear the data
gotoFirstPage, type: boolean
, make the first page as a current page.
- Implemented in:
-
SurveyModel
- See also:
-
data *
, state *
, currentPage
|
|
Clears files from server.
- Type:
-
(question: IQuestion, name: string, value: any, fileName: string, callback: (status: string, data: any) => any) => void
- Parameters:
-
question, type: IQuestion
, question
name, type: string
, question name
value, type: any
, file question value
fileName, type: string
callback, type: (status: string, data: any) => any
, call back function to get the status of the clearing operation
- Implemented in:
-
SurveyModel
|
|
Call this function to remove all question values from the survey, that end-user will not be able to enter.
For example the value that doesn't exists in a radiogroup/dropdown/checkbox choices or matrix rows/columns.
Please note, this function doesn't clear values for invisible questions or values that doesn't associated with questions.
In fact this function just call clearIncorrectValues function of all questions in the survey
- Type:
-
(removeNonExisingRootKeys?: boolean) => void
- Parameters:
-
removeNonExisingRootKeys, type: boolean
,
- set this parameter to true to remove keys from survey.data that doesn't have corresponded questions and calculated values
- Implemented in:
-
SurveyModel
- See also:
-
Question.clearIncorrectValues *
, Page.clearIncorrectValues *
, Panel.clearIncorrectValues
|
|
Gets or sets a value that specifies how the invisible data is included in survey data.
The following options are available:
none - include the invisible values into the survey data.
onHidden - clear the question value when it becomes invisible. If a question has value and it was invisible initially then survey clears the value on completing.
onHiddenContainer - clear the question value when it or its parent (page or panel) becomes invisible. If a question has value and it was invisible initially then survey clears the value on completing.
onComplete (default) - clear invisible question values on survey complete. In this case, the invisible questions will not be stored on the server.
- Type:
-
any writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Default value:
- onComplete
- Accepted values:
-
none
, onComplete
, onHidden
, onHiddenContainer
- Implemented in:
-
SurveyModel
- See also:
-
Question.visible *
, onComplete
|
|
Removes a value from the survey results.
- Type:
-
(name: string) => void
- Parameters:
-
name, type: string
, The name of the value. Typically it is a question name.
- Implemented in:
-
SurveyModel
|
|
Gets or sets whether to clear value on disable items in checkbox, dropdown and radiogroup questions.
By default, values are not cleared on disabled the corresponded items. This property is not persisted in survey JSON and you have to set it in code.
- Type:
-
boolean writable
- Implemented in:
-
SurveyModel
|
|
Gets or sets user's identifier (e.g., e-mail or unique customer id) in your web application.
If you load survey or post survey results from/to api.surveyjs.io service, then the library do not allow users to run the same survey the second time.
On the second run, the user will see the survey complete page.
- Type:
-
string writable
- Implemented in:
-
SurveyModel
|
|
Creates a new object that has the same type and properties as the current SurveyJS object.
- Type:
-
() => Base
- Implemented in:
-
Base
|
|
The HTML content displayed to an end user that has already completed the survey.
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
- See also:
-
clientId *
, locale
|
|
Gets or sets the HTML content displayed on the complete page. Use this property to change the default complete page text.
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
- See also:
-
showCompletedPage *
, completedHtmlOnCondition *
, View Demo
|
|
The list of HTML condition items. If the expression of this item returns true , then a survey will use this item HTML instead of completedHtml .
- Type:
-
HtmlConditionItem[] writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
- See also:
-
HtmlConditionItem *
, completeHtml
|
|
Completes the survey, if the current page is the last one. It returns false if the last page has errors.
If the last page has no errors, completeLastPage calls doComplete and returns true .
- Type:
-
() => boolean
- Implemented in:
-
SurveyModel
- See also:
-
isCurrentPageValid *
, nextPage *
, doComplete
|
|
Gets or sets the 'Complete' button caption.
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
- See also:
-
locale
|
|
Gets or sets a cookie name used to save information about completing the survey.
If the property is not empty, before starting the survey, the Survey library checks if the cookie with this name exists.
If it is true , the survey goes to complete mode and a user sees the survey complete page. On completing the survey the cookie with this name is created.
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
|
|
Creates and returns a new page, but do not add it into the survey.
You can use addPage(page) function to add it into survey later.
- Type:
-
(name: string) => PageModel
- Parameters:
-
name, type: string
- Implemented in:
-
SurveyModel
- See also:
-
addPage *
, addNewPage
|
|
Gets or sets the current survey page. If a survey is rendered, then this property returns a page that a user can see/edit.
- Type:
-
any writable
- Implemented in:
-
SurveyModel
|
|
The zero-based index of the current page in the visible pages array.
View Demo
- Type:
-
number writable
- Implemented in:
-
SurveyModel
|
|
Gets or sets an object with survey results. You can set this property with an object of the following structure:
{
question1Name: question1Value,
question2Name: question2Value,
// ...
}
When you set this property in code, the new object overrides the old object that may contain default question values and entered data. If you want to merge the new and old objects, call the mergeData(newDataObj) method.
If you assign a new object while a respondent takes the survey, set the currentPageNo property to 0 to start the survey from the beginning. This will also cause the survey to re-evaluate the visibleIf , enableIf , and other expressions.
- Type:
-
any writable
- Implemented in:
-
SurveyModel
- See also:
-
setValue *
, getValue
|
|
Default value for loadingHtml property
- Type:
-
string readonly
- Implemented in:
-
SurveyModel
- See also:
-
loadingHtml
|
|
Deletes the cookie with cookieName from the browser.
- Type:
-
() => void
- Implemented in:
-
SurveyModel
- See also:
-
cookieName *
, hasCookie *
, setCookie
|
|
Explanatory text displayed under the title.
- Type:
-
string writable
- Implemented in:
-
SurveyElementCore
- See also:
-
hasDescription
|
|
Use this method to dispose survey model properly.
- Type:
-
() => void
- Implemented in:
-
SurveyModel
|
|
Completes the survey.
Calling this function performs the following tasks:
- writes cookie if the
cookieName property is not empty
- sets the survey into
completed state
- fires the
onComplete event
- calls
sendResult function.
Calling the doComplete function does not perform any validation, unlike the completeLastPage function.
The function can return false, if you set options.allowComplete to false in onCompleting event. Otherwise it returns true.
It calls navigateToUrl after calling onComplete event.
In case calling options.showSaveInProgress callback in the onComplete event, navigateToUrl is used on calling options.showSaveSuccess callback.
- Type:
-
(isCompleteOnTrigger?: boolean) => boolean
- Parameters:
-
isCompleteOnTrigger, type: boolean
- Implemented in:
-
SurveyModel
- See also:
-
completeLastPage *
, onCompleting *
, cookieName *
, state *
, onComplete *
, surveyPostId *
, completeLastPage *
, navigateToUrl *
, navigateToUrlOnCondition
|
|
Downloads a file from server
- Type:
-
(question: IQuestion, questionName: string, fileValue: any, callback: (status: string, data: any) => any) => void
- Parameters:
-
question, type: IQuestion
questionName, type: string
fileValue, type: any
, a single file question value
callback, type: (status: string, data: any) => any
, a call back function to get the status on downloading the file and the downloaded file content
- Implemented in:
-
SurveyModel
|
|
Gets or sets the 'Edit' button caption.
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
- See also:
-
locale *
, showPreviewBeforeComplete *
, previewText *
, cancelPreview
|
|
Returns the text displayed when a survey has no visible pages and questions.
- Type:
-
string readonly
- Implemented in:
-
SurveyModel
|
|
Checks whether survey elements (pages, panels, and questions) have unique question names.
You can check for unique names for individual page and panel (and all their elements) or a question.
If the parameter is not specified, then a survey checks that all its elements have unique names.
- Type:
-
(element?: ISurveyElement) => void
- Parameters:
-
element, type: ISurveyElement
, page, panel or question, it is null by default, that means all survey elements will be checked
- Implemented in:
-
SurveyModel
|
|
Gets or sets whether the first survey page is a start page. Set this property to true , to make the first page a starting page.
An end user cannot navigate to the start page and the start page does not affect a survey progress.
- Type:
-
boolean writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
|
|
Sets the input focus to the first question with the input field.
- Type:
-
() => void
- Implemented in:
-
SurveyModel
|
|
Gets or sets whether the first input is focused on showing a next or a previous page.
- Type:
-
boolean writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Default value:
- True
- Implemented in:
-
SurveyModel
|
|
Gets or sets whether the first input is focused if the current page has errors.
Set this property to false (the default value is true ) if you do not want to bring the focus to the first question that has error on the page.
- Type:
-
boolean writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Default value:
- True
- Implemented in:
-
SurveyModel
|
|
Focus question by its name. If needed change the current page on the page where question is located.
Function returns false if there is no question with this name or question is invisible, otherwise it returns true.
- Type:
-
(name: string) => boolean
- Parameters:
-
name, type: string
, question name
- Implemented in:
-
SurveyModel
|
|
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) => void
- Parameters:
-
json, type: any
, A JSON object with properties that you want to apply to the current SurveyJS object.
- Implemented in:
-
Base
- See also:
-
toJSON
|
|
Returns a list of all survey's panels.
- Type:
-
(visibleOnly?: boolean, includingDesignTime?: boolean) => IPanel[]
- Parameters:
-
visibleOnly, type: boolean
includingDesignTime, type: boolean
- Implemented in:
-
SurveyModel
|
|
Returns a list of all questions in a survey.
- Type:
-
(visibleOnly?: boolean, includingDesignTime?: boolean) => Question[]
- Parameters:
-
visibleOnly, type: boolean
, set it true , if you want to get only visible questions
includingDesignTime, type: boolean
- Implemented in:
-
SurveyModel
|
|
Returns an amount of corrected quiz answers.
- Type:
-
() => number
- Implemented in:
-
SurveyModel
|
|
Returns an amount of incorrect quiz answers.
- Type:
-
() => number
- Implemented in:
-
SurveyModel
|
|
Returns a page on which an element (question or panel) is placed.
- Type:
-
(element: IElement) => PageModel
- Parameters:
-
element, type: IElement
, Question or Panel
- Implemented in:
-
SurveyModel
|
|
Returns a page by it's name.
- Type:
-
(name: string) => PageModel
- Parameters:
-
name, type: string
- Implemented in:
-
SurveyModel
|
|
Returns a page on which a question is located.
- Type:
-
(question: IQuestion) => PageModel
- Parameters:
-
question, type: IQuestion
- Implemented in:
-
SurveyModel
|
|
Returns a list of pages by their names.
- Type:
-
(names: string[]) => PageModel[]
- Parameters:
-
names, type: string[]
, a list of page names
- Implemented in:
-
SurveyModel
|
|
Returns a panel by its name.
- Type:
-
(name: string, caseInsensitive?: boolean) => PanelModel
- Parameters:
-
name, type: string
, a panel name
caseInsensitive, type: boolean
- Implemented in:
-
SurveyModel
- See also:
-
getQuestionByName
|
|
Returns survey results as an array of objects in which the question name, title, value, and other parameters are stored as individual properties.
If a question can have more than one value (Matrix, Multiple Text), its object enables the isNode flag and stores information about these values in the data property. Refer to the following help topic for more information: Access Full Survey Results.
If you want to skip empty answers, pass an object with the includeEmpty property set to false .
- Type:
-
(options?: { includeEmpty?: boolean; includeQuestionTypes?: boolean; includeValues?: boolean; calculations?: { propertyName: string; }[]; }) => IQuestionPlainData[]
- Parameters:
-
options, type: { includeEmpty?: boolean; includeQuestionTypes?: boolean; includeValues?: boolean; calculations?: { propertyName: string; }[]; }
- Implemented in:
-
SurveyModel
|
|
Returns the progress that a user made while going through the survey.
It depends from progressBarType property
- Type:
-
() => number
- Implemented in:
-
SurveyModel
- See also:
-
progressBarType *
, progressValue
|
|
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) => 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.
- Implemented in:
-
Base
|
|
Returns a question by its name.
- Type:
-
(name: string, caseInsensitive?: boolean) => Question
- Parameters:
-
name, type: string
, a question name
caseInsensitive, type: boolean
- Implemented in:
-
SurveyModel
- See also:
-
getQuestionByValueName
|
|
Returns a question by its value name
- Type:
-
(valueName: string, caseInsensitive?: boolean) => IQuestion
- Parameters:
-
valueName, type: string
, a question name
caseInsensitive, type: boolean
- Implemented in:
-
SurveyModel
- See also:
-
getQuestionByName *
, getQuestionsByValueName *
, Question.valueName
|
|
Gets a list of questions by their names.
- Type:
-
(names: string[], caseInsensitive?: boolean) => IQuestion[]
- Parameters:
-
names, type: string[]
, an array of question names
caseInsensitive, type: boolean
- Implemented in:
-
SurveyModel
|
|
Returns all questions by their valueName. name property is used if valueName property is empty.
- Type:
-
(valueName: string, caseInsensitive?: boolean) => Question[]
- Parameters:
-
valueName, type: string
, a question name
caseInsensitive, type: boolean
- Implemented in:
-
SurveyModel
- See also:
-
getQuestionByName *
, getQuestionByValueName *
, Question.valueName
|
|
Returns quiz question number. It may be different from getQuizQuestions.length because some widgets like matrix may have several questions.
- Type:
-
() => number
- Implemented in:
-
SurveyModel
- See also:
-
getQuizQuestions
|
|
Returns quiz questions. All visible questions that has input(s) widgets.
- Type:
-
() => IQuestion[]
- Implemented in:
-
SurveyModel
- See also:
-
getQuizQuestionCount
|
|
Calls the api.surveyjs.io service and, on callback, fires the onGetResult event with all answers that your users made for a question.
- Type:
-
(resultId: string, name: string) => void
- Parameters:
-
name, type: string
, The question name
- Implemented in:
-
SurveyModel
- See also:
-
onGetResult
|
|
Returns the object type as it is used in the JSON schema.
- Type:
-
() => string
- Implemented in:
-
Base
|
|
Returns an array of locales that are used in the survey's translation.
- Type:
-
() => string[]
- Implemented in:
-
SurveyModel
|
|
Returns a question value (answer) by a question's name.
- Type:
-
(name: string) => any
- Parameters:
-
name, type: string
, A question name
- Implemented in:
-
SurveyModel
- See also:
-
data *
, setValue
|
|
Returns a variable value. Variable, unlike values, are not stored in the survey results.
- Type:
-
(name: string) => any
- Parameters:
-
name, type: string
, A variable name
- Implemented in:
-
SurveyModel
- See also:
-
SetVariable
|
|
Returns all variables in the survey. Use setVariable function to create a new variable.
- Type:
-
() => string[]
- Implemented in:
-
SurveyModel
- See also:
-
getVariable *
, setVariable
|
|
Gets or ses whether user proceeds to the next page without pressing the "Next" button after answering all page questions.
The available options:
true - navigate to the next page and submit survey data automatically.
autogonext - navigate to the next page automatically but do not submit survey data.
false - do not navigate to the next page and do not submit survey data automatically.
If any of the following questions is answered last, the survey won't be switched to the next page: Checkbox, Boolean (rendered as Checkbox), Comment, Signature Pad, Image Picker (with Multi Select), File, Single-Choice Matrix (not all rows are answered), Dynamic Matrix, Panel Dynamic.
- Type:
-
boolean | "autogonext" writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
- See also:
-
View Demo
|
|
Returns true , if a user has already completed the survey in this browser and there is a cookie about it. Survey goes to completed state if the function returns true .
- Type:
-
boolean readonly
- Implemented in:
-
SurveyModel
- See also:
-
cookieName *
, setCookie *
, deleteCookie *
, state
|
|
Returns true if the survey element has a description.
- Type:
-
boolean readonly
- Implemented in:
-
SurveyElementCore
- See also:
-
description
|
|
Gets or sets whether to hide all required errors.
- Type:
-
boolean readonly
- Implemented in:
-
SurveyModel
|
|
Gets or sets whether the survey must ignore validation like required questions and others, on nextPage and completeLastPage function calls. The default is false .
- Type:
-
boolean readonly
- Implemented in:
-
SurveyModel
- See also:
-
nextPage *
, completeLastPage *
, mode
|
|
- Type:
-
boolean readonly
- Implemented in:
-
Base
|
|
Returns true if the current page does not contain errors.
- Type:
-
boolean readonly
- Implemented in:
-
SurveyModel
- See also:
-
currentPage
|
|
Use this method to find out if the current object is of a given typeName or inherited from it.
- Type:
-
(typeName: string) => boolean
- Parameters:
-
typeName, type: string
, One of the values listed in the getType() description.
- Implemented in:
-
Base
- See also:
-
getType
|
|
Returns true if the survey is in design mode. It is used by SurveyJS Editor.
- Type:
-
boolean readonly
- Implemented in:
-
SurveyModel
- See also:
-
setDesignMode
|
|
Returns true if the survey is in display mode or in preview mode.
- Type:
-
boolean readonly
- Implemented in:
-
SurveyModel
- See also:
-
mode *
, showPreviewBeforeComplete
|
|
Returns true if the survey is in edit mode.
- Type:
-
boolean readonly
- Implemented in:
-
SurveyModel
- See also:
-
mode
|
|
Returns true if the survey contains no pages. The survey is empty.
- Type:
-
boolean readonly
- Implemented in:
-
SurveyModel
|
|
Gets whether the current page is the first one.
- Type:
-
boolean readonly
- Implemented in:
-
SurveyModel
|
|
Gets whether the current page is the last one.
- Type:
-
boolean readonly
- Implemented in:
-
SurveyModel
|
|
Returns true if the object configuration is being loaded from JSON.
- Type:
-
boolean readonly
- Implemented in:
-
Base
|
|
Returns the navigation buttons (i.e., 'Prev', 'Next', or 'Complete' and 'Preview') position.
- Type:
-
string readonly
- Implemented in:
-
SurveyModel
|
|
Returns true if the navigation buttons (i.e., 'Prev', 'Next', or 'Complete' and 'Preview') are shows on bottom.
- Type:
-
boolean readonly
- Implemented in:
-
SurveyModel
|
|
Returns true if the navigation buttons (i.e., 'Prev', 'Next', or 'Complete' and 'Preview') are shows on top.
- Type:
-
boolean readonly
- Implemented in:
-
SurveyModel
|
|
Survey is showing a page right now. It is in "running", "preview" or starting state.
- Type:
-
boolean readonly
- Implemented in:
-
SurveyModel
|
|
The started page is showing right now. survey state equals to "starting"
- Type:
-
boolean readonly
- Implemented in:
-
SurveyModel
|
|
Gets whether the question values on the current page are validating on the server at the current moment.
- Type:
-
boolean readonly
- Implemented in:
-
SurveyModel
- See also:
-
onServerValidateQuestions
|
|
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
|
|
The list of errors on loading survey JSON. If the list is empty after loading a JSON, then the JSON is correct and has no errors.
- Type:
-
JsonError[] readonly
- Implemented in:
-
SurveyModel
- See also:
-
JsonError
|
|
Specifies whether to keep values that cannot be assigned to questions, for example, choices unlisted in the choices array.
This property cannot be specified in the survey JSON schema. Use dot notation to specify it.
- Type:
-
boolean writable
- Implemented in:
-
SurveyModel
- See also:
-
clearIncorrectValues
|
|
By default all rows are rendered no matters if they are visible or not.
Set it true, and survey markup rows will be rendered only if they are visible in viewport.
This feature is experimantal and might do not support all the use cases.
View Demo
- Type:
-
boolean writable
- Implemented in:
-
SurveyModel
|
|
The HTML that shows on loading survey Json from the api.surveyjs.io service.
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
- See also:
-
surveyId *
, locale
|
|
Loads the survey JSON from the api.surveyjs.io service.
If clientId is not null and a user had completed a survey before, the survey switches to completedbefore state.
- Type:
-
(surveyId?: string, cliendId?: string) => void
- Parameters:
-
cliendId, type: string
- Implemented in:
-
SurveyModel
- See also:
-
state *
, onLoadedSurveyFromService
|
|
Gets or sets the survey locale. The default value it is empty, this means the 'en' locale is used.
You can set it to 'de' - German, 'fr' - French and so on. The library has built-in localization for several languages. The library has a multi-language support as well.
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Accepted values:
-
, id
, ca
, cy
, da
, de
, et
, es
, eu
, fr
, hi
, hr
, it
, kk
, lv
, lt
, hu
, ms
, nl
, no
, pl
, pt
, pt-br
, ro
, sk
, rs
, fi
, sv
, sw
, tel
, tr
, vi
, nl-BE
, is
, cs
, gr
, bg
, mk
, ru
, tg
, ua
, he
, ar
, fa
, th
, ka
, ja
, zh-cn
, zh-tw
, ko
- Implemented in:
-
SurveyModel
|
|
Gets or sets a survey logo.
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
- See also:
-
title
|
|
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Default value:
- contain
- Accepted values:
-
none
, contain
, cover
, fill
- Implemented in:
-
SurveyModel
- See also:
-
logo
|
|
Gets or sets a survey logo height.
- Type:
-
any writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Default value:
- 200px
- Implemented in:
-
SurveyModel
- See also:
-
logo
|
|
Gets or sets a survey logo position.
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Default value:
- left
- Accepted values:
-
none
, left
, right
, top
, bottom
- Implemented in:
-
SurveyModel
- See also:
-
logo
|
|
Gets or sets a survey logo width.
- Type:
-
any writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Default value:
- 300px
- Implemented in:
-
SurveyModel
- See also:
-
logo
|
|
- Type:
-
number writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
- See also:
-
Question.showCommentArea *
, Question.showOtherItem *
, maxTextLength
|
|
Specifies the default maximum length for questions like text and comment, including matrix cell questions.
The default value is 0 , that means that the text and comment have the same max length as the standard HTML input - 524288 characters: https://www.w3schools.com/tags/att_input_maxlength.asp.
- Type:
-
number writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
- See also:
-
maxOthersLength
|
|
Gets or sets the maximum time in seconds that end user has to complete a survey. If the value is 0 or less, an end user has no time limit to finish a survey.
- Type:
-
number writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
- See also:
-
startTimer *
, maxTimeToFinishPage
|
|
Gets or sets the maximum time in seconds that end user has to complete a page in the survey. If the value is 0 or less, an end user has no time limit.
You may override this value for every page.
- Type:
-
number writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
- See also:
-
startTimer *
, maxTimeToFinish *
, PageModel.maxTimeToFinish
|
|
Merges a specified data object with the object from the data property.
Refer to the following help topic for more information: Merge Question Values.
- Type:
-
(data: any) => void
- Parameters:
-
data, type: any
, A data object to merge. It should have the following structure: { questionName: questionValue, ... }
- Implemented in:
-
SurveyModel
- See also:
-
setValue
|
|
Gets or sets the survey edit mode.
The following options are available:
edit (default) - make a survey editable,
display - make a survey read-only.
View Demo
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Default value:
- edit
- Accepted values:
-
edit
, display
- Implemented in:
-
SurveyModel
|
|
A URL to which respondents should be navigated after survey completion.
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
- See also:
-
onNavigateToUrl *
, navigateToUrlOnCondition
|
|
An array of objects that allows you to navigate respondents to different URLs after survey completion.
Each object should include the expression and url properties. When expression evaluates to true , the survey navigates to the corresponding url . Refer to the following help topic for more information about expressions: Expressions.
- Type:
-
UrlConditionItem[] writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
- See also:
-
onNavigateToUrl *
, navigateToUrl
|
|
Navigates user to the next page.
Returns false in the following cases:
- if the current page is the last page.
- if the current page contains errors (for example, a required question is empty).
- Type:
-
() => boolean
- Implemented in:
-
SurveyModel
- See also:
-
isCurrentPageValid *
, prevPage *
, completeLastPage
|
|
An event that is raised right after a page is rendered in DOM. Use it to modify HTML elements.
sender : SurveyModel - A survey instance that raised the event.
options.page - a page object for which the event is fired. Typically the current/active page.
options.htmlElement - an HTML element bound to the page object.
View Demo
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
An event that is raised right after a panel is rendered in DOM. Use it to modify HTML elements.
sender : SurveyModel - A survey instance that raised the event.
options.panel - a panel object for which the event is fired
options.htmlElement - an HTML element bound to the panel object
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
An event that is raised right after a question is rendered in DOM. Use it to modify HTML elements.
sender : SurveyModel - A survey instance that raised the event.
options.question - a question object for which the event is fired.
options.htmlElement - an HTML element bound to the question object.
View Demo
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
An event that is raised right after a non-composite question (text, comment, dropdown, radiogroup, checkbox) is rendered in DOM. Use it to modify HTML elements.
This event is not fired for matrices, panels, multiple text and image picker.
sender : SurveyModel - A survey instance that raised the event.
options.question - a question object for which the event is fired.
options.htmlElement - an HTML element bound to the question object.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
An event that is raised right after survey is rendered in DOM.
sender : SurveyModel - A survey instance that raised the event.
options.htmlElement - a root HTML element bound to the survey object.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
Use this event to load choice items in Dropdown and Tag Box questions on demand.
This event is raised only for those questions that have the choicesLazyLoadEnabled property set to true .
Parameters:
sender : SurveyModel
A survey instance that raised the event.
options.question
A Question instance for which the event is raised.
options.skip : Number
The number of choice items to skip.
options.take : Number
The number of choice items to load. You can use the question's choicesLazyLoadPageSize property to change this number.
options.filter
A search string used to filter choices.
options.setItems(items: Array<any>, totalCount: Number)
A method that you should call to assign loaded items to the question. Item objects should be structured as specified in the choices property description. If their structure is different, map their properties to bring them to the required structure.
View Demo
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
This event is fired on clearing the value in a QuestionFile. Use this event to remove files stored on your server.
sender : SurveyModel - A survey instance that raised the event.
question - the question instance.
options.name - the question name.
options.value - the question value.
options.fileName - a removed file's name, set it to null to clear all files.
options.callback - a callback function to get the operation status.
View Demo
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
clearFiles *
, onDownloadFile *
, onUploadFiles
|
|
An event that is raised after the survey is completed. Use this event to send survey results to the server.
Parameters:
sender : SurveyModel
A survey instance that raised the event. Use sender.data to access survey results.
options.isCompleteOnTrigger : Boolean
Returns true if survey completion is caused by the "complete" trigger.
options.showSaveInProgress(text?: string)
Call this method to indicate that the save operation is in progress. You can use the text parameter to display a custom message.
options.showSaveError(text?: string)
Call this method to indicate that an error occurred during the save operation. You can use the text parameter to display a custom error message.
options.showSaveSuccess(text?: string)
Call this method to indicate that survey results are successfully saved. You can use the text parameter to display a custom message.
options.clearSaveMessages()
Call this method to hide the save operation messages.
For an example of how to use the methods described above, refer to the following help topic: Store Survey Results in Your Own Database.
Do not disable the showCompletedPage property if you call one of the options.showSave... methods. This is required because the UI that indicates data saving progress is integrated into the complete page. If you hide the complete page, the UI also becomes invisible.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
onPartialSend *
, doComplete *
, allowCompleteSurveyAutomatic
|
|
An event that is raised before the survey is completed. Use this event to prevent survey completion.
Parameters:
sender : SurveyModel
A survey instance that raised the event.
options.allow : Boolean
Set this property to false if you want to prevent survey completion.
options.isCompleteOnTrigger : Boolean
Returns true if survey completion is caused by the "complete" trigger.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
onComplete *
, doComplete *
, allowCompleteSurveyAutomatic
|
|
An event that is raised after the current page is switched.
Parameters:
sender : SurveyModel
A survey instance that raised the event.
options.oldCurrentPage : PageModel
A page that used to be current.
options.newCurrentPage : PageModel
The current page.
options.isNextPage : Boolean
Returns true if the respondent is going forward along the survey.
options.isPrevPage : Boolean
Returns true if the respondent is going backwards, that is, newCurrentPage is earlier in the survey than oldCurrentPage .
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
currentPageNo *
, nextPage *
, prevPage
|
|
An event that is raised before the current page is switched.
Parameters:
sender : SurveyModel
A survey instance that raised the event.
options.oldCurrentPage : PageModel
The current page.
options.newCurrentPage : PageModel
A page that will be current.
options.allow : Boolean
Set this property to false if you do not want to switch the current page.
options.isNextPage : Boolean
Returns true if the respondent is going forward along the survey.
options.isPrevPage : Boolean
Returns true if the respondent is going backwards, that is, newCurrentPage is earlier in the survey than oldCurrentPage .
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
currentPageNo *
, nextPage *
, prevPage **
|
|
An event that is raised on downloading a file in QuestionFile. Use this event to pass the file to a preview.
sender : SurveyModel - A survey instance that raised the event.
question - the question instance.
options.name - the question name.
options.content - the file content.
options.fileValue - single file question value.
options.callback - a callback function to get the file downloading status and the downloaded file content.
View Demo
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
downloadFile *
, onClearFiles *
, onUploadFiles
|
|
Use this event to control drag&drop operations during design mode.
sender : SurveyModel - A survey instance that raised the event.
options.allow - set it to false to disable dragging.
options.target - a target element that is dragged.
options.source - a source element. It can be null , if it is a new element, dragging from toolbox.
options.parent - a page or panel where target element is dragging.
options.insertBefore - an element before the target element is dragging. It can be null if parent container (page or panel) is empty or dragging an element after the last element in a container.
options.insertAfter - an element after the target element is dragging. It can be null if parent container (page or panel) is empty or dragging element to the first position within the parent container.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
setDesignMode *
, isDesignMode
|
|
An event that is raised after a new panel is added to a Dynamic Panel question.
Parameters:
sender : SurveyModel
A survey instance that raised the event.
options.question : QuestionPanelDynamicModel
A Dynamic Panel question.
options.panel : PanelModel
An added panel.
options.panelIndex : Number
The panel's index within Dynamic Panel.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
An event that is raised after an item value is changed in a panel within a Dynamic Panel question.
Parameters:
sender : SurveyModel
A survey instance that raised the event.
options.question : QuestionPanelDynamicModel
A Dynamic Panel question.
options.panel : PanelModel
A panel that nests the item with a changed value.
options.name : String
The item's name.
options.value : any
The item's new value.
options.panelIndex : Number
The panel's index within Dynamic Panel.
options.panelData : Object
The panel's data object that includes all item values.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
An event that is raised after a panel is deleted from a Dynamic Panel question.
Parameters:
sender : SurveyModel
A survey instance that raised the event.
options.question : QuestionPanelDynamicModel
A Dynamic Panel question.
options.panel : PanelModel
A deleted panel.
options.panelIndex : Number
The panel's index within Dynamic Panel.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
An event that is raised before a panel is deleted from a Dynamic Panel question. Use this event to cancel the deletion.
Parameters:
sender : SurveyModel
A survey instance that raised the event.
options.question : QuestionPanelDynamicModel
A Dynamic Panel question.
options.panel : PanelModel
A panel to be deleted.
options.panelIndex : Number
The panel's index within Dynamic Panel.
options.allow : Boolean
Set this property to false if you want to cancel the panel deletion.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
An event that is raised after the survey element content was collapsed or expanded.
sender : SurveyModel - A survey instance that raised the event.
options.element - Specifies which survey element content was collapsed or expanded.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
onElementContentVisibilityChanged
|
|
Use the event to change the default error text.
sender : SurveyModel - A survey instance that raised the event.
options.text - an error text.
options.error - an instance of the SurveyError object.
options.obj - an instance of Question, Panel or Survey object to where error is located.
options.name - the error name. The following error names are available:
required, requireoneanswer, requirenumeric, exceedsize, webrequest, webrequestempty, otherempty,
uploadingfile, requiredinallrowserror, minrowcounterror, keyduplicationerror, custom
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
The event occurs when an element within a panel gets focus.
sender : SurveyModel - A survey instance that raised the event.
options.panel - A panel whose child element gets focus.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
onFocusInQuestion
|
|
The event occurs when an element within a question gets focus.
sender : SurveyModel - A survey instance that raised the event.
options.question - A question whose child element gets focus.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
onFocusInPanel
|
|
Use this event to load a display text for the default choice item in Dropdown and Tag Box questions.
If you load choices from a server (use choicesByUrl or onChoicesLazyLoad ), display texts become available only when data is loaded, which does not happen until a user opens the drop-down menu. However, a display text for a default choice item is required before that. In this case, you can load data individually for the default item within the onGetChoiceDisplayValue event handler.
Parameters:
sender : SurveyModel
A survey instance that raised the event.
options.question
A Question instance for which the event is raised.
options.values
An array of one (in Dropdown) or more (in Tag Box) default values.
options.setItems(displayValues: Array<string>)
A method that you should call to assign display texts to the question.
View Demo
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
An event that is raised before expression question convert it's value into display value for rendering.
sender : SurveyModel - A survey instance that raised the event.
options.question - The expression question.
options.value - The question value.
options.displayValue - the display value that you can change before rendering.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
Use this event to create/customize actions to be displayed in a matrix question's row.
sender : SurveyModel - A survey instance that raised the event.
options.question - A matrix question (QuestionMatrixBaseModel object) for which the event is fired.
options.row - A matrix row for which the event is fired.
options.actions - A list of actions (IAction objects) associated with the processed matrix question and row.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
IAction *
, QuestionMatrixDropdownModelBase
|
|
Use this event to create/customize actions to be displayed in a page's title.
sender : SurveyModel - A survey instance that raised the event.
options.page - A page (PageModel object) for which the event is fired.
options.titleActions - A list of actions (IAction objects) associated with the processed page.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
IAction *
, PageModel
|
|
Use this event to create/customize actions to be displayed in a panel's title.
sender : SurveyModel - A survey instance that raised the event.
options.panel - A panel (PanelModel object) for which the event is fired.
options.titleActions - A list of actions (IAction objects) associated with the processed panel.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
IAction *
, PanelModel
|
|
Use this event to change the question no in code. If you want to remove question numbering then set showQuestionNumbers to "off".
sender : SurveyModel - A survey instance that raised the event.
options.no - a calculated question no, based on question visibleIndex , survey .questionStartIndex properties. You can change it.
options.question - a question object.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
showQuestionNumbers *
, questionStartIndex
|
|
Use this event to change the question title in code. If you want to remove question numbering then set showQuestionNumbers to "off".
sender : SurveyModel - A survey instance that raised the event.
options.title - a calculated question title, based on question title , name .
options.question - a question object.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
showQuestionNumbers *
, requiredText
Show More
|
|
Use this event to create/customize actions to be displayed in a question's title.
sender : SurveyModel - A survey instance that raised the event.
options.question - A Question object for which the event is fired.
options.titleActions - A list of actions (IAction objects) associated with the processed question.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
IAction *
, View Demo
|
|
Use it to get results after calling the getResult method. It returns a simple analytics from api.surveyjs.io service.
sender : SurveyModel - A survey instance that raised the event.
options.success - it is true if the results were got from the service successfully.
options.data - the object {AnswersCount, QuestionResult : {} } . AnswersCount is the number of posted survey results. QuestionResult is an object with all possible unique answers to the question and number of these answers.
options.dataList - an array of objects {name, value} , where name is a unique value/answer to the question and value is a number/count of such answers.
options.response - the server response.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
getResult
|
|
Use this event to change the element title tag name that renders by default.
sender : SurveyModel - A survey instance that raised the event.
options.element - an element (question, panel, page and survey) that SurveyJS is going to render.
options.tagName - an element title tagName that are used to render a title. You can change it from the default value.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
showQuestionNumbers *
, requiredText
|
|
Use this event to define, whether an answer to a question is correct or not.
sender : SurveyModel - A survey instance that raised the event.
options.question - a question on which you have to decide if the answer is correct or not.
options.result - returns true , if an answer is correct, or false , if the answer is not correct. Use questions' value and correctAnswer properties to return the correct value.
options.correctAnswers - you may change the default number of correct or incorrect answers in the question, for example for matrix, where each row is a quiz question.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
Question.value *
, Question.correctAnswer
|
|
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, any>
- Implemented in:
-
Base
|
|
An event that is raised after choices for radiogroup, checkbox, and dropdown has been loaded from a RESTful service and before they are assigned to a question.
You may change the choices, before they are assigned or disable/enabled make visible/invisible question, based on loaded results.
sender : SurveyModel - A survey instance that raised the event.
question - the question where loaded choices are going to be assigned.
choices - the loaded choices. You can change the loaded choices to before they are assigned to question.
serverResult - a result that comes from the server as it is.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
An event that is raised after survey is loaded from api.surveyjs.io service.
You can use this event to perform manipulation with the survey model after it was loaded from the web service.
sender : SurveyModel - A survey instance that raised the event.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
surveyId *
, loadSurveyFromService
|
|
An event that is raised for every cell after is has been rendered in DOM.
sender : SurveyModel - A survey instance that raised the event.
options.question - the matrix question.
options.cell - the matrix cell.
options.cellQuestion - the question/editor in the cell.
options.htmlElement - an HTML element bound to the cellQuestion object.
options.column - the matrix column object.
options.row - the matrix row object.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
onMatrixCellCreated *
, QuestionMatrixDynamicModel *
, QuestionMatrixDropdownModel
|
|
An event that is raised before rendering "Remove" button for removing a row from Matrix Dynamic question.
sender : SurveyModel - A survey instance that raised the event.
options.question - a matrix question.
options.rowIndex - a row index.
options.row - a row object.
options.allow - a boolean property. Set it to false to disable the row removing.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
QuestionMatrixDynamicModel *
, onMatrixRowRemoving *
, onMatrixRowRemoved
|
|
An event that is raised before adding a new row in Matrix Dynamic question.
sender : SurveyModel - A survey instance that raised the event.
options.question - a matrix question.
options.canAddRow - specifies whether a new row can be added
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
QuestionMatrixDynamicModel *
, QuestionMatrixDynamicModel.visibleRows
|
|
An event that is raised for every cell created in Matrix Dynamic and Matrix Dropdown questions.
sender : SurveyModel - A survey instance that raised the event.
options.question - the matrix question.
options.cell - the matrix cell.
options.cellQuestion - the question/editor in the cell. You may customize it, change it's properties, like choices or visible.
options.rowValue - the value of the current row. To access a particular column's value within the current row, use: options.rowValue["columnValue"] .
options.column - the matrix column object.
options.columnName - the matrix column name.
options.row - the matrix row object.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
onMatrixBeforeRowAdded *
, onMatrixCellCreating *
, onMatrixRowAdded *
, QuestionMatrixDynamicModel *
, QuestionMatrixDropdownModel
|
|
An event that is raised before creating cell question in the matrix. You can change the cell question type by setting different options.cellType.
sender : SurveyModel - A survey instance that raised the event.
options.question - the matrix question.
options.cellType - the cell question type. You can change it.
options.rowValue - the value of the current row. To access a particular column's value within the current row, use: options.rowValue["columnValue"] .
options.column - the matrix column object.
options.columnName - the matrix column name.
options.row - the matrix row object.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
onMatrixBeforeRowAdded *
, onMatrixCellCreated *
, QuestionMatrixDynamicModel *
, QuestionMatrixDropdownModel
|
|
An event that is raised when Matrix Dynamic and Matrix Dropdown questions validate the cell value.
sender : SurveyModel - A survey instance that raised the event.
options.error - an error string. It is empty by default.
options.question - the matrix question.
options.columnName - the matrix column name.
options.value - a cell value.
options.row - the matrix row object.
options.getCellQuestion(columnName) - the function that returns the cell question by column name.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
onMatrixBeforeRowAdded *
, onMatrixRowAdded *
, QuestionMatrixDynamicModel *
, QuestionMatrixDropdownModel
|
|
An event that is raised when cell value is changed in Matrix Dynamic and Matrix Dropdown questions.
sender : SurveyModel - A survey instance that raised the event.
options.question - the matrix question.
options.columnName - the matrix column name.
options.value - a new value.
options.row - the matrix row object.
options.getCellQuestion(columnName) - the function that returns the cell question by column name.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
onMatrixCellValueChanging *
, onMatrixBeforeRowAdded *
, onMatrixRowAdded *
, QuestionMatrixDynamicModel *
, QuestionMatrixDropdownModel
|
|
An event that is raised on changing cell value in Matrix Dynamic and Matrix Dropdown questions. You may change the options.value property to change a cell value.
sender : SurveyModel - A survey instance that raised the event.
options.question - the matrix question.
options.columnName - the matrix column name.
options.value - a new value.
options.oldValue - the old value.
options.row - the matrix row object.
options.getCellQuestion(columnName) - the function that returns a cell question by column name.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
onMatrixCellValueChanged *
, onMatrixBeforeRowAdded *
, onMatrixRowAdded *
, QuestionMatrixDynamicModel *
, QuestionMatrixDropdownModel
|
|
An event that is raised on adding a new row in Matrix Dynamic question.
sender : SurveyModel - A survey instance that raised the event.
options.question - a matrix question.
options.row - a new added row.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
QuestionMatrixDynamicModel *
, QuestionMatrixDynamicModel.visibleRows
|
|
An event that is raised on removing a row from Matrix Dynamic question.
sender : SurveyModel - A survey instance that raised the event.
options.question - a matrix question
options.rowIndex - a removed row index
options.row - a removed row object
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
QuestionMatrixDynamicModel *
, QuestionMatrixDynamicModel.visibleRows *
, onMatrixRowRemoving *
, onMatrixAllowRemoveRow
|
|
An event that is raised before removing a row from Matrix Dynamic question. You can disable removing and clear the data instead.
sender : SurveyModel - A survey instance that raised the event.
options.question - a matrix question.
options.rowIndex - a row index.
options.row - a row object.
options.allow - a boolean property. Set it to false to disable the row removing.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
QuestionMatrixDynamicModel *
, onMatrixRowRemoved *
, onMatrixAllowRemoveRow
|
|
An event that is raised before the survey navigates to a specified URL. Use this event to change the URL or cancel the navigation.
Parameters:
sender : SurveyModel
A survey instance that raised the event.
options.url : String
A URL to which respondents should be navigated. You can modify this parameter's value.
options.allow : Boolean
Set this property to false if you want to cancel the navigation and show the complete page.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
navigateToUrl *
, navigateToUrlOnCondition
|
|
An event that is raised when a new page is added to the survey.
sender : SurveyModel
A survey instance that raised the event.
options.page : PageModel
A new page.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
PanelModel
|
|
An event that is raised after page visibility is changed.
Parameters:
sender : SurveyModel
A survey instance that raised the event.
options.page : PageModel
A page whose visibility has been changed.
options.visible : Boolean
Indicates whether the page is visible now.
Refer to the following help topic for information on how to implement conditional visibility: Conditional Visibility.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
An event that is raised when a new panel is added to a page.
sender : SurveyModel
A survey instance that raised the event.
options.panel : PanelModel
A new panel.
options.name : String
The panel's name.
options.index : Number
The panel's index within the parent container (panel or page).
options.parent : PanelModelBase
The parent container (panel or page).
options.page : PanelModelBase
A page that nests the added panel.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
An event that is raised after a panel is deleted from the survey.
Parameters:
sender : SurveyModel
A survey instance that raised the event.
options.panel : PanelModel
A deleted panel.
options.name : String
The panel's name.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
An event that is raised after page visibility is changed.
Parameters:
sender : SurveyModel
A survey instance that raised the event.
options.panel : PanelModel
A panel whose visibility has been changed.
options.visible : Boolean
Indicates whether the panel is visible now.
Refer to the following help topic for information on how to implement conditional visibility: Conditional Visibility.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
Use this event to save incomplete survey results. Enable the sendResultOnPageNext property for this event to occur.
Parameters:
sender : SurveyModel
A survey instance that raised the event.
Refer to the following help topic for more information on the use case: Continue an Incomplete Survey.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
Use this event to modify the HTML content before rendering, for example completeHtml or loadingHtml .
sender : SurveyModel - A survey instance that raised the event.
options.html - an HTML that you may change before text processing and then rendering. specifies the modified HTML content.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
completedHtml *
, loadingHtml *
, QuestionHtmlModel.html
|
|
An event that is raised on processing the text when it finds a text in brackets: {somevalue} . By default, it uses the value of survey question values and variables.
For example, you may use the text processing in loading choices from the web. If your choicesByUrl.url equals to "UrlToServiceToGetAllCities//",
you may set on this event options.value to "all" or empty string when the "state" value/question is non selected by a user.
sender : SurveyModel - A survey instance that raised the event.
options.name - the name of the processing value, for example, "state" in our example.
options.value - the value of the processing text.
options.isExists - a boolean value. Set it to true if you want to use the value and set it to false if you don't.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
Use this event to change the progress text in code.
sender : SurveyModel - A survey instance that raised the event.
options.text - a progress text, that SurveyJS will render in progress bar.
options.questionCount - a number of questions that have input(s). We do not count html or expression questions
options.answeredQuestionCount - a number of questions that have input(s) and an user has answered.
options.requiredQuestionCount - a number of required questions that have input(s). We do not count html or expression questions
options.requiredAnsweredQuestionCount - a number of required questions that have input(s) and an user has answered.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
progressBarType
|
|
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.
- Type:
-
EventBase<Base>
- Implemented in:
-
Base
|
|
An event that is raised when a new question is added to a panel or page.
sender : SurveyModel
A survey instance that raised the event.
options.question : Question
A new question.
options.name : String
The question's name.
options.index : Number
The question's index within the parent container (panel or page).
options.parent : PanelModelBase
The parent container (panel or page).
options.page : PanelModelBase
A page that nests the added question.
To use this event for questions loaded from JSON, create an empty survey model, add an event handler, and only then populate the model from the JSON object:
import { Model } from "survey-core";
const surveyJson = {
// ...
};
// Create an empty model
const survey = new Model();
// Add an event handler
survey.onQuestionAdded.add((sender, options) => {
//...
});
// Load the survey JSON schema
survey.fromJSON(surveyJson);
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
onQuestionCreated
|
|
An event that is raised when the survey creates any new object derived from Question .
In a survey, complex elements (Dynamic Matrix, Multiple Text, and Dynamic Panel) are composed of questions. Use this event to customize any question regardless of which survey element it belongs to.
Parameters:
sender : SurveyModel
A survey instance that raised the event.
options.question : Question
A created question.
To use this event for questions loaded from JSON, create an empty survey model, add an event handler, and only then populate the model from the JSON object:
import { Model } from "survey-core";
const surveyJson = {
// ...
};
// Create an empty model
const survey = new Model();
// Add an event handler
survey.onQuestionCreated.add((sender, options) => {
//...
});
// Load the survey JSON schema
survey.fromJSON(surveyJson);
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
onQuestionAdded
|
|
An event that is raised after a question is deleted from the survey.
Parameters:
sender : SurveyModel
A survey instance that raised the event.
options.question : Question
A deleted question.
options.name : String
The question's name.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
An event that is raised after question visibility is changed.
Parameters:
sender : SurveyModel
A survey instance that raised the event.
options.question : Question
A question whose visibility has been changed.
options.name : String
The question's name.
options.visible : Boolean
Indicates whether the question is visible now.
Refer to the following help topic for information on how to implement conditional visibility: Conditional Visibility.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
Use this event to control scrolling element to top. You can cancel the default behavior by setting options.cancel property to true.
sender : SurveyModel - A survey instance that raised the event.
options.element - an element that is going to be scrolled on top.
options.question - a question that is going to be scrolled on top. It can be null if options.page is not null.
options.page - a page that is going to be scrolled on top. It can be null if options.question is not null.
options.elementId - the unique element DOM Id.
options.cancel - set this property to true to cancel the default scrolling.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
The event fires when it gets response from the api.surveyjs.io service on saving survey results. Use it to find out if the results have been saved successfully.
sender : SurveyModel - A survey instance that raised the event.
options.success - it is true if the results has been sent to the service successfully.
options.response - a response from the service.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
Use this event to validate data on your server.
Parameters:
sender : SurveyModel
A survey instance that raised the event.
options.data : Object
Question values. You can get an individual question value as follows: options.data["questionName"] .
options.errors : Object
An object for your error messages. Set error messages as follows: options.errors["questionName"] = "My error message"
options.complete() : Method
A method that you should call when a request to the server has completed.
View Demo
- Type:
-
any readonly
- Implemented in:
-
SurveyModel
- See also:
-
onValidateQuestion *
, onValidatePanel
|
|
An event that is raised before errors are assigned to a question. You may add/remove/modify errors for a question.
sender : SurveyModel - A survey instance that raised the event.
options.question - a validated question.
options.errors - the list of errors. The list is empty by default and remains empty if a validated question has no errors.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
onValidateQuestion
|
|
Use this event to change the visibility of an individual choice item in Checkbox, Dropdown, Radiogroup, and other similar question types.
Parameters:
sender : SurveyModel
A survey instance that raised the event.
options.question
A Question instance to which the choice item belongs.
options.item
The choice item as specified in the choices array.
options.visible
A Boolean value that specifies item visibility. Set it to false to hide the item.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
An event that is raised before the survey displays a preview. Use this event to cancel the preview.
Parameters:
sender : SurveyModel
A survey instance that raised the event.
options.allow : Boolean
Set this property to false if you want to cancel the preview.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
showPreviewBeforeComplete
|
|
An event that is raised when the survey state changes from "starting" to "running" . This occurs only if your survey includes a start page.
Parameters:
sender : SurveyModel
A survey instance that raised the event.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
firstPageIsStarted
|
|
Use this event to process the markdown text.
sender : SurveyModel - A survey instance that raised the event.
options.element - SurveyJS element (a question, panel, page, or survey) where the string is going to be rendered.
options.name - a property name is going to be rendered.
options.text - a text that is going to be rendered.
options.html - an HTML content. It is null by default. Use this property to specify the HTML content rendered instead of options.text .
View Demo
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
Use this event to specity render component name used for text rendering.
sender : SurveyModel - A survey instance that raised the event.
options.element - SurveyJS element (a question, panel, page, or survey) where the string is going to be rendered.
options.name - a property name is going to be rendered.
options.renderAs - a component name used for text rendering.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
An event that is raised every second if the method startTimer has been called.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
startTimer *
, timeSpent *
, Page.timeSpent
|
|
An event that is raised before displaying a new information in the Timer Panel. Use it to change the default text.
sender : SurveyModel - A survey instance that raised the event.
options.text - the timer panel info text.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
An event that is raised after a trigger is executed.
sender : SurveyModel - A survey instance that raised the event.
options.trigger : Trigger - A trigger that has been executed.
For more information about triggers, refer to the following help topic: Conditional Survey Logic (Triggers).
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
triggers *
, runTriggers
|
|
An event that is raised before rendering a choice item in radiogroup, checkbox or dropdown questions. Use it to override the default choice item css.
sender : SurveyModel - A survey instance that raised the event.
options.question - a question where choice item is rendered.
options.item - a choice item of ItemValue type. You can get value or text choice properties as options.item.value or options.choice.text
options.css - a string with css classes divided by space. You can change it.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
An event that is raised before rendering a page. Use it to override the default page CSS classes.
sender : SurveyModel - A survey instance that raised the event.
options.page - a page for which you can change the CSS classes.
options.cssClasses - an object with CSS classes. For example {title: "sv_p_title", description: "small"} . You can change them to your own CSS classes.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
An event that is raised before rendering a panel. Use it to override the default panel CSS classes.
sender : SurveyModel - A survey instance that raised the event.
options.panel - a panel for which you can change the CSS classes.
options.cssClasses - an object with CSS classes. For example {title: "sv_p_title", description: "small"} . You can change them to your own CSS classes.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
An event that is raised before rendering a question. Use it to override the default question CSS classes.
sender : SurveyModel - A survey instance that raised the event.
options.question - a question for which you can change the CSS classes.
options.cssClasses - an object with CSS classes. For example {root: "table", button: "button"} . You can change them to your own CSS classes.
View Demo
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
An event that is raised on uploading the file in QuestionFile when storeDataAsText is set to false . Use this event to change the uploaded file name or to prevent a particular file from being uploaded.
sender : SurveyModel - A survey instance that raised the event.
options.question - the file question instance.
options.name - the question name.
options.files - the Javascript File objects array to upload.
options.callback - a callback function to get the file upload status and the updloaded file content.
View Demo
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
uploadFiles *
, QuestionFileModel.storeDataAsText *
, onDownloadFile *
, onClearFiles
|
|
Use the this event to be notified when the survey finished validate questions on the current page. It commonly happens when a user try to go to the next page or complete the survey
options.questions - the list of questions that have errors
options.errors - the list of errors
options.page - the page where question(s) are located
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
|
|
An event that is raised when a panel is being validated. Use this event to specify a custom error message.
Parameters:
sender : SurveyModel
A survey instance that raised the event.
options.panel : PanelModel
A panel being validated.
options.name : String
The panel's name.
options.error : String
An error message that you should specify if validation fails.
View Demo
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
onValidateQuestion *
, onServerValidateQuestions
|
|
An event that is raised when a question value is being validated. Use this event to specify a custom error message.
Parameters:
sender : SurveyModel
A survey instance that raised the event.
options.question : Question
A question being validated.
options.name : String
The question's name.
options.value : any
A question value being validated.
options.error : String
An error message that you should specify if validation fails.
View Demo
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
onServerValidateQuestions *
, onValidatePanel *
, onMatrixCellValidate *
, onSettingQuestionErrors
|
|
An event that is raised after a question value is changed.
Parameters:
sender : SurveyModel
A survey instance that raised the event.
options.name : String
The name of the question whose value has been changed. If you use the valueName property, this parameter contains its value.
options.question : Question
The question whose value has been changed. If you use valueName , and it is the same for several questions, this parameter contains the first question.
options.value : any
A new value.
To handle value changes in matrix cells or panels within a Dynamic Panel, use the onMatrixCellValueChanged or onDynamicPanelItemValueChanged event.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
setValue
|
|
An event that is raised before a question value is changed.
Parameters:
sender : SurveyModel
A survey instance that raised the event.
options.name : String
The name of the question whose value is being changed. If you use the valueName property, this parameter contains its value.
options.question : Question
The question whose value is being changed. If you use valueName and it is the same for several questions, this parameter contains the first question.
options.oldValue : any
A previous value.
options.value : any
A new value. You can change it if required.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
setValue
|
|
An event that is raised after a variable or calculated value is changed.
Parameters:
sender : SurveyModel
A survey instance that raised the event.
options.name : String
The name of the variable or calculated value that has been changed.
options.value : any
A new value for the variable or calculated value.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
setVariable *
, calculatedValues
|
|
Obsolete. Please use onQuestionVisibleChanged event.
- Type:
-
EventBase<SurveyModel>
- Implemented in:
-
SurveyModel
- See also:
-
onQuestionVisibleChanged
|
|
Returns the survey page count.
- Type:
-
number readonly
- Implemented in:
-
SurveyModel
- See also:
-
visiblePageCount *
, pages
|
|
Gets or sets the 'Next' button caption.
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
- See also:
-
locale
|
|
Gets or sets the 'Prev' button caption.
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
- See also:
-
locale
|
|
Returns a list of all pages in the survey, including invisible pages.
- Type:
-
PageModel[] readonly
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
- See also:
-
PageModel *
, visiblePages
|
|
Gets or sets the 'Preview' button caption.
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
- See also:
-
locale *
, showPreviewBeforeComplete *
, editText *
, showPreview
|
|
Navigates user to a previous page. If the current page is the first page, prevPage returns false . prevPage does not perform any checks, required questions can be empty.
- Type:
-
() => boolean
- Implemented in:
-
SurveyModel
- See also:
-
isFirstPage
|
|
Returns the HTML content, that is shown to a user that had completed the survey before.
- Type:
-
string readonly
- Implemented in:
-
SurveyModel
- See also:
-
completedHtml *
, cookieName
|
|
Returns the HTML content for the complete page.
- Type:
-
string readonly
- Implemented in:
-
SurveyModel
- See also:
-
completedHtml
|
|
Returns the HTML content, that is shows when a survey loads the survey JSON.
- Type:
-
string readonly
- Implemented in:
-
SurveyModel
|
|
Gets or sets the type of info in the progress bar.
The following options are available:
pages (default),
questions ,
requiredQuestions ,
correctQuestions ,
buttons
View Demo
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Default value:
- pages
- Accepted values:
-
pages
, questions
, requiredQuestions
, correctQuestions
, buttons
- Implemented in:
-
SurveyModel
|
|
Returns the text for the current progress.
- Type:
-
string readonly
- Implemented in:
-
SurveyModel
|
|
Returns the progress that a user made while going through the survey.
It depends from progressBarType property
- Type:
-
number readonly
- Implemented in:
-
SurveyModel
- See also:
-
progressBarType
|
|
Gets or sets the question description position. The default value is underTitle .
The following options are available:
underTitle - show question description under the question title,
underInput - show question description under the question input instead of question title.
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Default value:
- underTitle
- Accepted values:
-
underInput
, underTitle
- Implemented in:
-
SurveyModel
|
|
Gets or sets the error message position.
The following options are available:
top - to show question error(s) over the question,
bottom - to show question error(s) under the question.
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Default value:
- top
- Accepted values:
-
top
, bottom
- Implemented in:
-
SurveyModel
|
|
Gets or sets a value that specifies how the survey combines questions, panels, and pages.
The following options are available:
singlePage - combine all survey pages in a single page. Pages will be converted to panels.
questionPerPage - show one question per page. Survey will create a separate page for every question.
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Default value:
- standard
- Accepted values:
-
singlePage
, standard
, questionPerPage
- Implemented in:
-
SurveyModel
|
|
Gets or sets the question display order. Use this property to randomize questions. You can randomize questions on a specific page.
The following options are available:
random - randomize questions
initial - keep questions in the same order, as in a survey model.
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Default value:
- initial
- Accepted values:
-
initial
, random
- Implemented in:
-
SurveyModel
- See also:
-
SurveyPage.questionsOrder
|
|
Gets or sets the first question index. The first question index is '1' by default. You may start it from '100' or from 'A', by setting '100' or 'A' to this property.
You can set the start index to "(1)" or "# A)" or "a)" to render question number as (1), # A) and a) accordingly.
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
- See also:
-
Question.title *
, View Demo
|
|
Gets or sets question title location relative to the input field: "top" , "bottom" , or "left" .
Certain question types (Matrix, Multiple Text) do not support the "left" value. For them, the "top" value is used.
You can override this setting if you specify the questionTitleLocation property for an individual page or panel or set the titleLocation property for a specific question.
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Default value:
- top
- Accepted values:
-
top
, bottom
, left
- Implemented in:
-
SurveyModel
|
|
Set the pattern for question title. Default is "numTitleRequire", 1. What is your name? *,
You can set it to numRequireTitle: 1. * What is your name?
You can set it to requireNumTitle: * 1. What is your name?
You can set it to numTitle (remove require symbol completely): 1. What is your name?
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Default value:
- numTitleRequire
- Implemented in:
-
SurveyModel
- See also:
-
View Demo
|
|
registerPropertyChangedHandlers
method
|
|
Registers a function to call when a property value changes.
- 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.
key, type: string
, (Optional) A key that identifies the current registration. If a function for one of the properties is already registered with the same key, the function will be overwritten. You can also use the key to subsequently unregister handlers.
- Implemented in:
-
Base
- See also:
-
unregisterPropertyChangedHandlers
|
|
Removes a page from a survey.
- Type:
-
(page: PageModel) => void
- Parameters:
-
page, type: PageModel
- Implemented in:
-
SurveyModel
|
|
Gets or sets the required question mark. The required question mark is a char or string that is rendered in the required questions' titles.
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Default value:
- *
- Implemented in:
-
SurveyModel
- See also:
-
View Demo
|
|
Calculates a given expression and returns true or false .
- Type:
-
(expression: string) => boolean
- Parameters:
-
expression, type: string
- Implemented in:
-
SurveyModel
|
|
Calculates a given expression and returns a result value.
- Type:
-
(expression: string) => any
- Parameters:
-
expression, type: string
- Implemented in:
-
SurveyModel
|
|
Run all triggers that performs on value changed and not on moving to the next page.
- Type:
-
() => void
- Implemented in:
-
SurveyModel
|
|
- Type:
-
(postId?: string, clientId?: string, isPartialCompleted?: boolean) => void
- Parameters:
-
clientId, type: string
, Typically a customer e-mail or an identifier
isPartialCompleted, type: boolean
, Set it to true if the survey is not completed yet and the results are intermediate
- Implemented in:
-
SurveyModel
- See also:
-
surveyPostId *
, clientId
|
|
Specifies whether to save survey results when respondents swtich between pages. Handle the onPartialSend event to implement the save operation.
Refer to the following help topic for more information on the use case: Continue an Incomplete Survey.
- Type:
-
boolean writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
|
|
Set the cookie with cookieName in user's browser. It is done automatically on survey complete if the cookieName property value is not empty.
- Type:
-
() => void
- Implemented in:
-
SurveyModel
- See also:
-
cookieName *
, hasCookie *
, deleteCookie
|
|
Sets the survey into design mode.
- Type:
-
(value: boolean) => void
- Parameters:
-
value, type: boolean
, use true to set the survey into the design mode.
- Implemented in:
-
SurveyModel
|
|
Assigns a new value to a specified property.
- Type:
-
(name: string, val: any) => void
- Parameters:
-
name, type: string
, A property name.
val, type: any
, A new value for the property.
- Implemented in:
-
Base
|
|
Sets a question value (answer). It runs all triggers and conditions (visibleIf properties).
Goes to the next page if goNextPageAutomatic is true and all questions on the current page are answered correctly.
- Type:
-
(name: string, newQuestionValue: any, locNotification?: any, allowNotifyValueChanged?: boolean) => void
- Parameters:
-
name, type: string
, A question name
newQuestionValue, type: any
locNotification, type: any
allowNotifyValueChanged, type: boolean
- Implemented in:
-
SurveyModel
- See also:
-
data *
, getValue *
, PageModel.visibleIf *
, Question.visibleIf *
, goNextPageAutomatic
|
|
Sets a variable value. Variable, unlike values, are not stored in the survey results.
- Type:
-
(name: string, newValue: any) => void
- Parameters:
-
name, type: string
, A variable name
newValue, type: any
, A variable new value
- Implemented in:
-
SurveyModel
- See also:
-
GetVariable
|
|
On finishing the survey the complete page is shown. Set the property to false , to hide the complete page.
- Type:
-
boolean writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Default value:
- True
- Implemented in:
-
SurveyModel
- See also:
-
data *
, onComplete *
, View Demo
|
|
Gets or sets whether to show all elements in the survey, regardless their visibility. The default value is false .
- Type:
-
boolean writable
- Implemented in:
-
SurveyModel
|
|
Gets or sets the navigation buttons position.
Possible values: 'bottom' (default), 'top', 'both' and 'none'. Set it to 'none' to hide 'Prev', 'Next' and 'Complete' buttons.
It makes sense if you are going to create a custom navigation, have only a single page, or the goNextPageAutomatic property is set to true .
- Type:
-
any writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Default value:
- bottom
- Accepted values:
-
none
, top
, bottom
, both
- Implemented in:
-
SurveyModel
- See also:
-
goNextPageAutomatic *
, showPrevButton
|
|
Gets or sets whether the survey displays page numbers on pages titles.
View Demo
- Type:
-
boolean writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
|
|
Gets or sets whether the Survey displays page titles. Set it to false to hide page titles.
- Type:
-
boolean writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Default value:
- True
- Implemented in:
-
SurveyModel
- See also:
-
View Demo
|
|
Gets or sets whether the Survey displays "Prev" button in its pages. Set it to false to prevent end-users from going back to their answers.
- Type:
-
boolean writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Default value:
- True
- Implemented in:
-
SurveyModel
- See also:
-
showNavigationButtons
|
|
Shows preview for the survey. Switches the survey to the "preview" state.
Details: Preview State
- Type:
-
() => boolean
- Implemented in:
-
SurveyModel
- See also:
-
showPreviewBeforeComplete *
, cancelPreview *
, state *
, previewText *
, editText
|
|
Allows respondents to preview answers before they are submitted.
Possible values:
"showAllQuestions" - Displays all questions in the preview.
"showAnsweredQuestions" - Displays only answered questions in the preview.
"noPreview" (default) - Hides the preview.
View Demo
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Default value:
- noPreview
- Accepted values:
-
noPreview
, showAllQuestions
, showAnsweredQuestions
- Implemented in:
-
SurveyModel
- See also:
-
showPreview *
, cancelPreview
|
|
Gets or sets the survey progress bar position.
The following options are available:
off (default) - don't show progress bar
top - show progress bar in the top
bottom - show progress bar in the bottom
both - show progress bar in both sides: top and bottom.
View Demo
- 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
, top
, bottom
, both
- Implemented in:
-
SurveyModel
|
|
Gets or sets a value that specifies how the question numbers are displayed.
The following options are available:
on - display question numbers
onpage - display question numbers, start numbering on every page
off - turn off the numbering for questions titles
View Demo
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Default value:
- on
- Accepted values:
-
on
, onPage
, off
- Implemented in:
-
SurveyModel
|
|
Gets or sets a timer panel position. The timer panel displays information about how much time an end user spends on a survey/page.
The available options:
top - display timer panel in the top.
bottom - display timer panel in the bottom.
none - do not display a timer panel.
If the value is not equal to 'none', the survey calls the startTimer() method on survey rendering.
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Default value:
- none
- Accepted values:
-
none
, top
, bottom
- Implemented in:
-
SurveyModel
- See also:
-
showTimerPanelMode *
, startTimer *
, stopTimer
|
|
Gets or set a value that specifies whether the timer displays information for the page or for the entire survey.
The available options:
page - show timer information for page
survey - show timer information for survey
Use the onTimerPanelInfoText event to change the default text.
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Default value:
- all
- Accepted values:
-
all
, page
, survey
- Implemented in:
-
SurveyModel
- See also:
-
showTimerPanel *
, onTimerPanelInfoText
|
|
Gets or sets whether the Survey displays survey title in its pages. Set it to false to hide a survey title.
- Type:
-
boolean writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Default value:
- True
- Implemented in:
-
SurveyModel
- See also:
-
View Demo
|
|
Starts the survey. Changes the survey mode from "starting" to "running". Call this function if your survey has a start page, otherwise this function does nothing.
- Type:
-
() => boolean
- Implemented in:
-
SurveyModel
- See also:
-
firstPageIsStarted
|
|
Returns the started page. This property works if the firstPageIsStarted property is set to true .
- Type:
-
PageModel readonly
- Implemented in:
-
SurveyModel
- See also:
-
firstPageIsStarted
|
|
Gets or sets the 'Start' button caption.
The 'Start' button is shown on the started page. Set the firstPageIsStarted property to true , to display the started page.
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
- See also:
-
firstPageIsStarted *
, locale
|
|
Starts a timer that will calculate how much time end-user spends on the survey or on pages.
- Type:
-
() => void
- Implemented in:
-
SurveyModel
- See also:
-
stopTimer *
, timeSpent
|
|
Returns the current survey state.
Possible values:
"loading" - The survey is being loaded from a JSON schema.
"empty" - The survey has no elements to display.
"starting" - The survey displays a start page.
"running" - A respondent is taking the survey.
"preview" - A respondent is previewing answers before submitting them.
"completed" - A respondent has completed the survey and submitted the results.
- Type:
-
string readonly
- Implemented in:
-
SurveyModel
|
|
- Type:
-
() => void
- Implemented in:
-
SurveyModel
- See also:
-
startTimer *
, timeSpent
|
|
Gets or sets an identifier of a survey model loaded from the api.surveyjs.io service. When specified, the survey JSON is automatically loaded from api.surveyjs.io service.
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
- See also:
-
loadSurveyFromService *
, onLoadedSurveyFromService
|
|
Gets or sets an identifier of a survey model saved to the api.surveyjs.io service. When specified, the survey data is automatically saved to the api.surveyjs.io service.
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
- See also:
-
onComplete *
, surveyShowDataSaving
|
|
Gets or sets whether to show the progress on saving/sending data into the api.surveyjs.io service.
- Type:
-
boolean writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
- See also:
-
surveyPostId
|
|
Gets or sets a value that specifies how the survey updates its questions' text values.
The following options are available:
onBlur (default) - the value is updated after an input loses the focus.
onTyping - update the value of text questions, "text" and "comment", on every key press.
Note, that setting to "onTyping" may lead to a performance degradation, in case you have many expressions in the survey.
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Default value:
- onBlur
- Accepted values:
-
onBlur
, onTyping
- Implemented in:
-
SurveyModel
|
|
Returns the time in seconds an end user spends on the survey
- Type:
-
number readonly
- Implemented in:
-
SurveyModel
- See also:
-
startTimer *
, PageModel.timeSpent
|
|
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
|
|
Returns a JSON object that corresponds to the current SurveyJS object.
- Type:
-
() => any
- Implemented in:
-
Base
- See also:
-
fromJSON
|
|
Gets or sets a list of triggers in the survey.
- Type:
-
SurveyTrigger[] writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
- See also:
-
SurveyTrigger
|
|
unregisterPropertyChangedHandlers
method
|
|
Unregisters value change event handlers for the specified properties.
- Type:
-
(propertyNames: string[], key?: string) => void
- Parameters:
-
propertyNames, type: string[]
, An array of one or multiple property names.
key, type: string
, (Optional) A key of the registration that you want to cancel.
- Implemented in:
-
Base
- See also:
-
registerPropertyChangedHandlers
|
|
Uploads a file to server.
- Type:
-
(question: IQuestion, name: string, files: any[], uploadingCallback: (status: string, data: any) => any) => void
- Parameters:
-
question, type: IQuestion
, a file question object
name, type: string
, a question name
files, type: any[]
, files to upload
uploadingCallback, type: (status: string, data: any) => any
, a call back function to get the status on uploading the files
- Implemented in:
-
SurveyModel
|
|
Validates all questions and returns false if the validation fails.
If you use validation expressions and at least one of them calls an async function, the validate method returns undefined . In this case, you should pass a callback function as the onAsyncValidation parameter. The function's hasErrors Boolean parameter will contain the validation result.
- Type:
-
(fireCallback?: boolean, focusOnFirstError?: boolean, onAsyncValidation?: (hasErrors: boolean) => void) => boolean
- Parameters:
-
fireCallback, type: boolean
, Optional. Pass false if you do not want to show validation errors in the UI.
focusOnFirstError, type: boolean
, Optional. Pass true if you want to focus the first question with a validation error. The survey will be switched to the page that contains this question if required.
onAsyncValidation, type: (hasErrors: boolean) => void
, Optional. Pass a callback function. It accepts a Boolean hasErrors parameter that equals true if the validation fails or false otherwise.
- Implemented in:
-
SurveyModel
- See also:
-
validateCurrentPage *
, validatePage
|
|
Validates all questions on the current page and returns false if the validation fails.
If you use validation expressions and at least one of them calls an async function, the validateCurrentPage method returns undefined . In this case, you should pass a callback function as the onAsyncValidation parameter. The function's hasErrors Boolean parameter will contain the validation result.
- Type:
-
(onAsyncValidation?: (hasErrors: boolean) => void) => boolean
- Parameters:
-
onAsyncValidation, type: (hasErrors: boolean) => void
, Optional. Pass a callback function. It accepts a Boolean hasErrors parameter that equals true if the validation fails or false otherwise.
- Implemented in:
-
SurveyModel
- See also:
-
currentPage *
, validate *
, validateCurrentPage
|
|
Validates all questions on a specified page and returns false if the validation fails.
If you use validation expressions and at least one of them calls an async function, the validatePage method returns undefined . In this case, you should pass a callback function as the onAsyncValidation parameter. The function's hasErrors Boolean parameter will contain the validation result.
- Type:
-
(page?: PageModel, onAsyncValidation?: (hasErrors: boolean) => void) => boolean
- Parameters:
-
page, type: PageModel
, Pass the PageModel that you want to validate. You can pass undefined to validate the activePage .
onAsyncValidation, type: (hasErrors: boolean) => void
, Optional. Pass a callback function. It accepts a Boolean hasErrors parameter that equals true if the validation fails or false otherwise.
- Implemented in:
-
SurveyModel
- See also:
-
validate *
, validateCurrentPage
|
|
Returns a number of visible pages within the survey.
- Type:
-
number readonly
- Implemented in:
-
SurveyModel
- See also:
-
pageCount *
, visiblePages
|
|
Returns a list of visible pages. If all pages are visible, then this property returns the same list as the pages property.
- Type:
-
PageModel[] readonly
- Implemented in:
-
SurveyModel
- See also:
-
pages *
, PageModel.visible *
, PageModel.visibleIf
|
|
A survey width in CSS values.
Default value: undefined (the survey inherits the width from its container)
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Implemented in:
-
SurveyModel
|
|
Gets or sets a value that specifies how the survey width is calculated.
The available options:
static - A survey has a fixed width that mostly depends upon the applied theme. Resizing a browser window does not affect the survey width.
responsive - A survey takes all available horizontal space. A survey stretches or shrinks horizonally according to the screen size.
auto - Depends on the question type and corresponds to the static or responsive mode.
- Type:
-
string writable
This property is stored in the survey JSON definition and can be edited in the Survey Creator.
- Default value:
- auto
- Accepted values:
-
auto
, static
, responsive
- Implemented in:
-
SurveyModel
|