UNPKG

survey-core

Version:

survey.js is a JavaScript Survey Library. It is a modern way to add a survey to your website. It uses JSON for survey metadata and results.

770 lines 174 kB
import { JsonError } from "./jsonobject"; import { Base, EventBase } from "./base"; import { ISurvey, ISurveyData, ISurveyImpl, ITextProcessor, IQuestion, IPanel, IElement, IPage, ISurveyErrorOwner, ISurveyElement, IProgressInfo, IFindElement, ISurveyLayoutElement, IPlainDataOptions, LayoutElementContainer, IValueItemCustomPropValues, ILoadFromJSONOptions, IDropdownMenuOptions, ITextProcessorProp, ITextProcessorResult } from "./base-interfaces"; import { SurveyElementCore } from "./survey-element"; import { ISurveyTriggerOwner, SurveyTrigger, Trigger } from "./trigger"; import { CalculatedValue } from "./calculatedValue"; import { PageModel } from "./page"; import { LocalizableString } from "./localizablestring"; import { SurveyTimerModel, ISurveyTimerText } from "./surveyTimerModel"; import { IQuestionPlainData, Question } from "./question"; import { QuestionSelectBase } from "./question_baseselect"; import { ItemValue } from "./itemvalue"; import { PanelModel, QuestionRowModel } from "./panel"; import { HtmlConditionItem, UrlConditionItem } from "./expressionItems"; import { SurveyError } from "./survey-error"; import { IAction, Action } from "./actions/action"; import { ActionContainer } from "./actions/container"; import { QuestionPanelDynamicModel } from "./question_paneldynamic"; import { Notifier } from "./notifier"; import { TriggerExecutedEvent, CompletingEvent, CompleteEvent, ShowingPreviewEvent, NavigateToUrlEvent, CurrentPageChangingEvent, CurrentPageChangedEvent, ValueChangingEvent, ValueChangedEvent, VariableChangedEvent, QuestionVisibleChangedEvent, PageVisibleChangedEvent, PanelVisibleChangedEvent, QuestionCreatedEvent, QuestionAddedEvent, QuestionRemovedEvent, PanelAddedEvent, PanelRemovedEvent, PageAddedEvent, ValidateQuestionEvent, SettingQuestionErrorsEvent, ValidatePanelEvent, ErrorCustomTextEvent, ValidatePageEvent, ValidatedErrorsOnCurrentPageEvent, ProcessHtmlEvent, GetQuestionTitleEvent, GetTitleTagNameEvent, GetQuestionNumberEvent, GetPageNumberEvent, GetPanelNumberEvent, GetProgressTextEvent, TextMarkdownEvent, SendResultEvent, GetResultEvent, UploadFilesEvent, DownloadFileEvent, ClearFilesEvent, ChoicesLoadedEvent, ProcessDynamicTextEvent, UpdateQuestionCssClassesEvent, UpdatePanelCssClassesEvent, UpdatePageCssClassesEvent, UpdateChoiceItemCssEvent, AfterRenderSurveyEvent, AfterRenderPageEvent, AfterRenderQuestionEvent, AfterRenderQuestionInputEvent, AfterRenderPanelEvent, FocusInQuestionEvent, FocusInPanelEvent, ShowingChoiceItemEvent, ChoicesLazyLoadEvent, GetChoiceDisplayValueEvent, MatrixRowAddedEvent, MatrixBeforeRowAddedEvent, MatrixRowRemovingEvent, MatrixRowRemovedEvent, MatrixAllowRemoveRowEvent, MatrixDetailPanelVisibleChangedEvent, MatrixCellCreatingEvent, MatrixCellCreatedEvent, MatrixAfterCellRenderEvent, MatrixCellValueChangedEvent, MatrixCellValueChangingEvent, MatrixCellValidateEvent, DynamicPanelModifiedEvent, DynamicPanelRemovingEvent, DynamicPanelItemValueChangedEvent, DynamicPanelValueChangingEvent, DynamicPanelGetTabTitleEvent, DynamicPanelCurrentIndexChangedEvent, CheckAnswerCorrectEvent, DragDropAllowEvent, ScrollToTopEvent, GetQuestionTitleActionsEvent, GetPanelTitleActionsEvent, GetPageTitleActionsEvent, GetPanelFooterActionsEvent, GetMatrixRowActionsEvent, GetExpressionDisplayValueEvent, ServerValidateQuestionsEvent, MultipleTextItemAddedEvent, MatrixColumnAddedEvent, GetQuestionDisplayValueEvent, PopupVisibleChangedEvent, ChoicesSearchEvent, OpenFileChooserEvent, OpenDropdownMenuEvent, ResizeEvent, ProgressTextEvent, ScrollingElementToTopEvent, IsAnswerCorrectEvent, LoadChoicesFromServerEvent, ProcessTextValueEvent, CreateCustomChoiceItemEvent } from "./survey-events-api"; import { QuestionMatrixDropdownModelBase } from "./question_matrixdropdownbase"; import { QuestionMatrixDynamicModel } from "./question_matrixdynamic"; import { QuestionFileModel } from "./question_file"; import { QuestionMultipleTextModel } from "./question_multipletext"; import { ITheme, ImageFit, ImageAttachment } from "./themes"; import { PopupModel } from "./popup"; import { Cover } from "./header"; import { QuestionSignaturePadModel } from "./question_signaturepad"; /** * The `SurveyModel` object contains properties and methods that allow you to control the survey and access its elements. * * [View Demo](https://surveyjs.io/form-library/examples/nps-question/ (linkStyle)) */ export declare class SurveyModel extends SurveyElementCore implements ISurvey, ISurveyData, ISurveyImpl, ISurveyTriggerOwner, ISurveyErrorOwner, ISurveyTimerText { static readonly TemplateRendererComponentName: string; [index: string]: any; static platform: string; get platformName(): string; notifier: Notifier; rootElement: HTMLElement; /** * A suffix added to the name of the property that stores comments. * * Default value: "-Comment" * * Many question types allow respondents to leave comments. To enable this functionality, set a question's [`showCommentArea`](https://surveyjs.io/form-library/documentation/api-reference/checkbox-question-model#showCommentArea) property to `true`. Comment values are saved in a separate property. The property name is composed of the question `name` and `commentSuffix`. * * Respondents can also leave comments when they select "Other" in choice-based questions, such as Dropdown or Checkboxes. The property name for the comment value is composed according to the same rules. However, you can use the question `name` as a key to store the comment value instead. Disable the [`storeOthersAsComment`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#storeOthersAsComment) property in this case. * * [View Demo](https://surveyjs.io/form-library/examples/create-checkboxes-question-in-javascript/ (linkStyle)) */ get commentSuffix(): string; set commentSuffix(val: string); get commentPrefix(): string; set commentPrefix(val: string); private valuesHash; private variablesHash; private editingObjValue; private timerModelValue; private navigationBarValue; /** * An event that is raised after a [trigger](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#triggers) is executed. * * For information on event handler parameters, refer to descriptions within the interface. * * [Conditional Survey Logic (Triggers)](https://surveyjs.io/form-library/documentation/design-survey/conditional-logic#conditional-survey-logic-triggers (linkStyle)) * @see triggers * @see runTriggers */ onTriggerExecuted: EventBase<SurveyModel, TriggerExecutedEvent>; /** * An event that is raised before the survey is completed. Use this event to prevent survey completion. * @see onComplete * @see doComplete * @see autoAdvanceAllowComplete */ onCompleting: EventBase<SurveyModel, CompletingEvent>; /** * An event that is raised after the survey is completed. Use this event to send survey results to the server. * * For information on event handler parameters, refer to descriptions within the interface. * * For an example of how to use the methods described above, refer to the following help topic: [Store Survey Results in Your Own Database](https://surveyjs.io/form-library/documentation/handle-survey-results-store#store-survey-results-in-your-own-database). * * > Do not disable the [`showCompletePage`](https://surveyjs.io/form-library/documentation/surveymodel#showCompletePage) property if you call one of the `options.showSave...` methods. This is required because the UI that indicates data saving progress is integrated into the complete page. If you hide the complete page, the UI also becomes invisible. * @see onPartialSend * @see doComplete * @see autoAdvanceAllowComplete */ onComplete: EventBase<SurveyModel, CompleteEvent>; /** * An event that is raised before the survey displays a [preview of given answers](https://surveyjs.io/form-library/documentation/design-survey/create-a-multi-page-survey#preview-page). Use this event to cancel the preview. * @see showPreviewBeforeComplete * @see previewMode * @see showPreview * @see cancelPreview */ onShowingPreview: EventBase<SurveyModel, ShowingPreviewEvent>; /** * An event that is raised before the survey navigates to a specified URL. Use this event to change the URL or cancel the navigation. * @see navigateToUrl * @see navigateToUrlOnCondition */ onNavigateToUrl: EventBase<SurveyModel, NavigateToUrlEvent>; /** * An event that is raised when the survey [`state`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#state) changes to `"running"`. * @see firstPageIsStartPage */ onStarted: EventBase<SurveyModel, {}>; /** * An event that is raised to save incomplete survey results. Enable the [`partialSendEnabled`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#partialSendEnabled) property for this event to occur. * * For information on event handler parameters, refer to descriptions within the interface. * * Alternatively, you can handle the [`onCurrentPageChanged`](#onCurrentPageChanged) and [`onValueChanged`](#onValueChanged) events, as shown in the following demo: [Continue an Incomplete Survey](https://surveyjs.io/form-library/examples/survey-editprevious/). */ onPartialSend: EventBase<SurveyModel, {}>; /** * An event that is raised before the current page is switched. * * @see currentPageNo * @see nextPage * @see prevPage **/ onCurrentPageChanging: EventBase<SurveyModel, CurrentPageChangingEvent>; /** * An event that is raised after the current page is switched. * * @see currentPageNo * @see nextPage * @see prevPage */ onCurrentPageChanged: EventBase<SurveyModel, CurrentPageChangedEvent>; /** * An event that is raised before a question value is changed. * @see setValue */ onValueChanging: EventBase<SurveyModel, ValueChangingEvent>; /** * An event that is raised after a question value is changed. * * For information on event handler parameters, refer to descriptions within the interface. * * To handle value changes in matrix cells or panels within a [Dynamic Panel](https://surveyjs.io/form-library/documentation/api-reference/dynamic-panel-model), use the [`onMatrixCellValueChanged`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onMatrixCellValueChanged) or [`onDynamicPanelValueChanged`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onDynamicPanelValueChanged) event. * @see setValue */ onValueChanged: EventBase<SurveyModel, ValueChangedEvent>; /** * An event that is raised after a [variable](https://surveyjs.io/form-library/documentation/design-survey/conditional-logic#variables) or [calculated value](https://surveyjs.io/form-library/documentation/design-survey/conditional-logic#calculated-values) is changed. * * @see setVariable * @see calculatedValues */ onVariableChanged: EventBase<SurveyModel, VariableChangedEvent>; /** * An event that is raised after question visibility is changed. * * For information on event handler parameters, refer to descriptions within the interface. * * Refer to the following help topic for information on how to implement conditional visibility: [Conditional Visibility](https://surveyjs.io/form-library/documentation/design-survey/conditional-logic#conditional-visibility). */ onQuestionVisibleChanged: EventBase<SurveyModel, QuestionVisibleChangedEvent>; onVisibleChanged: EventBase<SurveyModel, any>; /** * An event that is raised after page visibility is changed. * * For information on event handler parameters, refer to descriptions within the interface. * * Refer to the following help topic for information on how to implement conditional visibility: [Conditional Visibility](https://surveyjs.io/form-library/documentation/design-survey/conditional-logic#conditional-visibility). */ onPageVisibleChanged: EventBase<SurveyModel, PageVisibleChangedEvent>; /** * An event that is raised after panel visibility is changed. * * For information on event handler parameters, refer to descriptions within the interface. * * Refer to the following help topic for information on how to implement conditional visibility: [Conditional Visibility](https://surveyjs.io/form-library/documentation/design-survey/conditional-logic#conditional-visibility). */ onPanelVisibleChanged: EventBase<SurveyModel, PanelVisibleChangedEvent>; /** * An event that is raised when the survey creates any new object derived from [`Question`](https://surveyjs.io/form-library/documentation/api-reference/question). * * In a survey, complex elements ([Dynamic Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdynamic/), [Multiple Text](https://surveyjs.io/form-library/examples/questiontype-multipletext/), and [Dynamic Panel](https://surveyjs.io/form-library/examples/questiontype-paneldynamic/)) are composed of questions. Use this event to customize any question regardless of which survey element it belongs to. * * For information on event handler parameters, refer to descriptions within the interface. * * 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: * * ```js * 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); * ``` * @see onQuestionAdded */ onQuestionCreated: EventBase<SurveyModel, QuestionCreatedEvent>; /** * An event that is raised when a new question is added to a panel or page. * * For information on event handler parameters, refer to descriptions within the interface. * * 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: * * ```js * 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); * ``` * @see onQuestionCreated */ onQuestionAdded: EventBase<SurveyModel, QuestionAddedEvent>; /** * An event that is raised after a question is deleted from the survey. */ onQuestionRemoved: EventBase<SurveyModel, QuestionRemovedEvent>; /** * An event that is raised when a new panel is added to a page. */ onPanelAdded: EventBase<SurveyModel, PanelAddedEvent>; /** * An event that is raised after a panel is deleted from the survey. */ onPanelRemoved: EventBase<SurveyModel, PanelRemovedEvent>; /** * An event that is raised when a new page is added to the survey. * @see PanelModel */ onPageAdded: EventBase<SurveyModel, PageAddedEvent>; /** * An event that is raised when a question value is being validated. Use this event to add/remove/modify errors or specify a custom error message. * * For information on event handler parameters, refer to descriptions within the interface. * * [View Demo](https://surveyjs.io/form-library/examples/add-custom-input-validation/ (linkStyle)) * @see onServerValidateQuestions * @see onValidatePanel * @see onMatrixCellValidate * @see onSettingQuestionErrors */ onValidateQuestion: EventBase<SurveyModel, ValidateQuestionEvent>; /** * @deprecated Use the [`onValidateQuestion`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onValidateQuestion) property instead. */ onSettingQuestionErrors: EventBase<SurveyModel, SettingQuestionErrorsEvent>; /** * Use this event to validate data on your server. * * For information on event handler parameters, refer to descriptions within the interface. * * [View Demo](https://surveyjs.io/form-library/examples/javascript-server-side-form-validation/ (linkStyle)) * @see onValidateQuestion * @see onValidatePanel * @see isValidatingOnServer */ onServerValidateQuestions: EventBase<SurveyModel, ServerValidateQuestionsEvent>; /** * An event that is raised when a panel is being validated. Use this event to add/remove/modify errors or specify a custom error message. * * For information on event handler parameters, refer to descriptions within the interface. * * [View Demo](https://surveyjs.io/form-library/examples/add-custom-input-validation/ (linkStyle)) * @see onValidateQuestion * @see onServerValidateQuestions */ onValidatePanel: EventBase<SurveyModel, ValidatePanelEvent>; /** * @deprecated Use the [`onValidateQuestion`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onValidateQuestion), [`onValidatePanel`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onValidatePanel), and [`onValidatePage`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onValidatePage) events instead. */ onErrorCustomText: EventBase<SurveyModel, ErrorCustomTextEvent>; /** * An event that is raised when a survey page is being validated. Use this event to add/remove/modify errors. */ onValidatePage: EventBase<SurveyModel, ValidatePageEvent>; /** * @deprecated Use the [`onValidatePage`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onValidatePage) event instead. */ onValidatedErrorsOnCurrentPage: EventBase<SurveyModel, ValidatedErrorsOnCurrentPageEvent>; /** * An event that is raised when the survey processes HTML content. Handle this event to modify HTML content before displaying. * @see completedHtml * @see loadingHtml * @see QuestionHtmlModel.html */ onProcessHtml: EventBase<SurveyModel, ProcessHtmlEvent>; /** * Use this event to change a question's display text. */ onGetQuestionDisplayValue: EventBase<SurveyModel, GetQuestionDisplayValueEvent>; /** * An event that is raised before the survey displays a question title. Handle this event to modify question titles. * * For information on event handler parameters, refer to descriptions within the interface. * * If you want to modify question numbers, handle the [`onGetQuestionNumber`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onGetQuestionNumber) event. * @see requiredMark */ onGetQuestionTitle: EventBase<SurveyModel, GetQuestionTitleEvent>; /** * An event that is raised when the survey applies HTML tags to a survey, page, panel, and question title. Handle this event to change the HTML tag of individual titles. * * For information on event handler parameters, refer to descriptions within the interface. * * If you want to specify HTML tags for all titles, use the [`titleTags`](https://surveyjs.io/form-library/documentation/api-reference/settings#titleTags) object in [global settings](https://surveyjs.io/form-library/documentation/api-reference/settings). * * [View Demo](https://surveyjs.io/form-library/examples/survey-titletagnames/ (linkStyle)) * @see onGetQuestionTitle * @see onGetQuestionNumber */ onGetTitleTagName: EventBase<SurveyModel, GetTitleTagNameEvent>; /** * An event that is raised before the survey calculates a question number. Handle this event to modify question numbers. * * For information on event handler parameters, refer to descriptions within the interface. * * If you want to hide question numbers, disable the [`showQuestionNumbers`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#showQuestionNumbers) property. * @see onGetQuestionTitle * @see questionStartIndex */ onGetQuestionNumber: EventBase<SurveyModel, GetQuestionNumberEvent>; /** * @deprecated Use the [`onGetQuestionNumber`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onGetQuestionNumber) event instead. */ onGetQuestionNo: EventBase<SurveyModel, GetQuestionNumberEvent>; /** * An event that is raised before the survey calculates a panel number. Handle this event to modify panel numbers. * * This event is raised only for the panels with a [specified title](https://surveyjs.io/form-library/documentation/api-reference/panel-model#title) and [visible number](https://surveyjs.io/form-library/documentation/api-reference/panel-model#showNumber). */ onGetPanelNumber: EventBase<SurveyModel, GetPanelNumberEvent>; /** * An event that is raised before the survey calculates a page number. Handle this event to modify page numbers. * * This event is raised only if the [`showPageNumbers`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#showPageNumbers) property is enabled. * * For information on event handler parameters, refer to descriptions within the interface. * @see onGetQuestionTitle * @see questionStartIndex */ onGetPageNumber: EventBase<SurveyModel, GetPageNumberEvent>; /** * An event that is raised before the survey displays progress text. Handle this event to change the progress text in code. * @see showProgressBar * @see progressBarLocation * @see progressBarType */ onGetProgressText: EventBase<SurveyModel, GetProgressTextEvent>; /** * @deprecated Use the [`onGetProgressText`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onGetProgressText) event instead. */ onProgressText: EventBase<SurveyModel, ProgressTextEvent>; /** * An event that is raised to convert Markdown content to HTML. * * For information on event handler parameters, refer to descriptions within the interface. * * [View Demo](https://surveyjs.io/form-library/examples/edit-survey-questions-markdown/ (linkStyle)) */ onTextMarkdown: EventBase<SurveyModel, TextMarkdownEvent>; onTextRenderAs: EventBase<SurveyModel, any>; /** * @deprecated Self-hosted Form Library [no longer supports integration with SurveyJS Demo Service](https://surveyjs.io/stay-updated/release-notes/v2.0.0#form-library-removes-apis-for-integration-with-surveyjs-demo-service). */ onSendResult: EventBase<SurveyModel, SendResultEvent>; /** * @deprecated Self-hosted Form Library [no longer supports integration with SurveyJS Demo Service](https://surveyjs.io/stay-updated/release-notes/v2.0.0#form-library-removes-apis-for-integration-with-surveyjs-demo-service). */ onGetResult: EventBase<SurveyModel, GetResultEvent>; /** * An event that is raised when a respondent opens a dialog window to select files. * @see chooseFiles */ onOpenFileChooser: EventBase<SurveyModel, OpenFileChooserEvent>; /** * An event that is raised when a File Upload or Signature Pad question starts to upload a file. Applies only if [`storeDataAsText`](https://surveyjs.io/form-library/documentation/api-reference/file-model#storeDataAsText) is `false`. Use this event to upload files to your server. * * For information on event handler parameters, refer to descriptions within the interface. * * [View Demo](https://surveyjs.io/form-library/examples/file-upload/ (linkStyle)) * @see uploadFiles * @see onDownloadFile * @see onClearFiles */ onUploadFiles: EventBase<SurveyModel, UploadFilesEvent>; /** * An event that is raised when a File Upload question starts to download a file. Use this event to implement file preview when your server stores only file names. * * For information on event handler parameters, refer to descriptions within the interface. * * [View Demo](https://surveyjs.io/form-library/examples/store-file-names-in-survey-results/ (linkStyle)) * @see downloadFile * @see onClearFiles * @see onUploadFiles */ onDownloadFile: EventBase<SurveyModel, DownloadFileEvent>; /** * An event that is raised when users clear files in a [File Upload](https://surveyjs.io/form-library/documentation/api-reference/file-model) question or clear signature in a [Signature Pad](https://surveyjs.io/form-library/documentation/api-reference/signature-pad-model) question. Use this event to delete files from your server. * * For information on event handler parameters, refer to descriptions within the interface. * * [View Demo](https://surveyjs.io/form-library/examples/file-delayed-upload/ (linkStyle)) * @see clearFiles * @see onDownloadFile * @see onUploadFiles */ onClearFiles: EventBase<SurveyModel, ClearFilesEvent>; /** * An event that is raised after choices are loaded from a server but before they are assigned to a choice-based question, such as [Dropdown](https://surveyjs.io/form-library/documentation/api-reference/dropdown-menu-model) or [Checkboxes](https://surveyjs.io/form-library/documentation/api-reference/checkbox-question-model). Handle this event if you need to modify the loaded choices. */ onChoicesLoaded: EventBase<SurveyModel, ChoicesLoadedEvent>; /** * @deprecated Use the [`onChoicesLoaded`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onChoicesLoaded) event instead. */ onLoadChoicesFromServer: EventBase<SurveyModel, LoadChoicesFromServerEvent>; /** * @deprecated Self-hosted Form Library [no longer supports integration with SurveyJS Demo Service](https://surveyjs.io/stay-updated/release-notes/v2.0.0#form-library-removes-apis-for-integration-with-surveyjs-demo-service). */ onLoadedSurveyFromService: EventBase<SurveyModel, {}>; /** * An event that is raised when the survey processes [dynamic texts](https://surveyjs.io/form-library/documentation/design-survey/conditional-logic#dynamic-texts) and any text in curly brackets. Use this event, for instance, to substitute parameters in a RESTful URL with real values when you [load choices by URL](https://surveyjs.io/form-library/documentation/api-reference/checkbox-question-model#choicesByUrl). */ onProcessDynamicText: EventBase<SurveyModel, ProcessDynamicTextEvent>; /** * @deprecated Use the [`onProcessDynamicText`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onProcessDynamicText) event instead. */ onProcessTextValue: EventBase<SurveyModel, ProcessTextValueEvent>; /** * An event that is raised before rendering a question. Use it to override default question CSS classes. * * For information on event handler parameters, refer to descriptions within the interface. * * [View Demo](https://surveyjs.io/form-library/examples/customize-survey-with-css/ (linkStyle)) * @see css */ onUpdateQuestionCssClasses: EventBase<SurveyModel, UpdateQuestionCssClassesEvent>; /** * An event that is raised before rendering a standalone panel and panels within [Dynamic Panel](https://surveyjs.io/form-library/examples/duplicate-group-of-fields-in-form/). Use it to override default panel CSS classes. * * For information on event handler parameters, refer to descriptions within the interface. * * [View Demo](https://surveyjs.io/form-library/examples/customize-survey-with-css/ (linkStyle)) * @see css */ onUpdatePanelCssClasses: EventBase<SurveyModel, UpdatePanelCssClassesEvent>; /** * An event that is raised before rendering a page. Use it to override default page CSS classes. * * For information on event handler parameters, refer to descriptions within the interface. * * [View Demo](https://surveyjs.io/form-library/examples/customize-survey-with-css/ (linkStyle)) * @see css */ onUpdatePageCssClasses: EventBase<SurveyModel, UpdatePageCssClassesEvent>; /** * An event that is raised before rendering a choice item in Radio Button Group and Checkboxes questions. Use it to override default CSS classes applied to choice items. * * For information on event handler parameters, refer to descriptions within the interface. * * [View Demo](https://surveyjs.io/form-library/examples/customize-survey-with-css/ (linkStyle)) * @see css */ onUpdateChoiceItemCss: EventBase<SurveyModel, UpdateChoiceItemCssEvent>; /** * An event that is raised after the survey is rendered to the DOM. Use this event to modify survey markup. * * For information on event handler parameters, refer to descriptions within the interface. * * [View Demo](https://surveyjs.io/form-library/examples/survey-animation/ (linkStyle)) */ onAfterRenderSurvey: EventBase<SurveyModel, AfterRenderSurveyEvent>; onAfterRenderHeader: EventBase<SurveyModel, any>; /** * An event that is raised after a page is rendered to the DOM. Use it to modify page markup. * * For information on event handler parameters, refer to descriptions within the interface. * * [View Demo](https://surveyjs.io/form-library/examples/survey-afterrender/ (linkStyle)) */ onAfterRenderPage: EventBase<SurveyModel, AfterRenderPageEvent>; /** * An event that is raised after a question is rendered to the DOM. Use it to modify question markup. * * For information on event handler parameters, refer to descriptions within the interface. * * [View Demo](https://surveyjs.io/form-library/examples/survey-afterrender/ (linkStyle)) */ onAfterRenderQuestion: EventBase<SurveyModel, AfterRenderQuestionEvent>; /** * An event that is raised after a question with a single input field is rendered to the DOM. Use it to modify question markup. * * For information on event handler parameters, refer to descriptions within the interface. * * > This event is not raised for questions without input fields ([HTML](https://surveyjs.io/form-library/documentation/questionhtmlmodel), [Image](https://surveyjs.io/form-library/documentation/questionimagemodel)) or questions with multiple input fields ([Matrix](https://surveyjs.io/form-library/documentation/questionmatrixmodel), [Multiple Text](https://surveyjs.io/form-library/documentation/questionmultipletextmodel)). */ onAfterRenderQuestionInput: EventBase<SurveyModel, AfterRenderQuestionInputEvent>; /** * An event that is raised after a panel is rendered to the DOM. Use it to modify panel markup. * * For information on event handler parameters, refer to descriptions within the interface. * * > This event is raised for static [Panels](https://surveyjs.io/form-library/examples/set-properties-on-multiple-questions-using-panel/) as well as panels within a [Dynamic Panel](https://surveyjs.io/form-library/examples/duplicate-group-of-fields-in-form/). */ onAfterRenderPanel: EventBase<SurveyModel, AfterRenderPanelEvent>; /** * An event that is raised when an element (input field, checkbox, radio button) within a question gets focus. * @see onFocusInPanel * @see autoFocusFirstQuestion * @see focusQuestion */ onFocusInQuestion: EventBase<SurveyModel, FocusInQuestionEvent>; /** * An event that is raised when an element within a panel gets focus. * @see onFocusInQuestion * @see autoFocusFirstQuestion * @see focusQuestion */ onFocusInPanel: EventBase<SurveyModel, FocusInPanelEvent>; /** * An event that is raised before a [choice item](https://surveyjs.io/form-library/documentation/api-reference/questionselectbase#choices) is displayed. Use this event to change the visibility of individual choice items in [Checkboxes](https://surveyjs.io/form-library/documentation/api-reference/checkbox-question-model), [Dropdown](https://surveyjs.io/form-library/documentation/api-reference/dropdown-menu-model), [Radio Button Group](https://surveyjs.io/form-library/documentation/api-reference/radio-button-question-model), and other similar question types. */ onShowingChoiceItem: EventBase<SurveyModel, ShowingChoiceItemEvent>; /** * Use this event to load choice items in [Dropdown](https://surveyjs.io/form-library/documentation/questiondropdownmodel) and [Tag Box](https://surveyjs.io/form-library/documentation/questiontagboxmodel) questions on demand. * * This event is raised only for those questions that have the [`choicesLazyLoadEnabled`](https://surveyjs.io/form-library/documentation/questiondropdownmodel#choicesLazyLoadEnabled) property set to `true`. * * For information on event handler parameters, refer to descriptions within the interface. * * [View Demo](https://surveyjs.io/form-library/examples/lazy-loading-dropdown/ (linkStyle)) */ onChoicesLazyLoad: EventBase<SurveyModel, ChoicesLazyLoadEvent>; /** * An event that is raised each time a search string in a [Dropdown](https://surveyjs.io/form-library/documentation/api-reference/dropdown-menu-model) or [Tag Box](https://surveyjs.io/form-library/documentation/api-reference/dropdown-tag-box-model) question changes. Use this event to implement custom filtering of choice options. * @see [QuestionDropdownModel.searchEnabled](https://surveyjs.io/form-library/documentation/api-reference/dropdown-menu-model#searchEnabled) * @see [QuestionDropdownModel.searchMode](https://surveyjs.io/form-library/documentation/api-reference/dropdown-menu-model#searchMode) */ onChoicesSearch: EventBase<SurveyModel, ChoicesSearchEvent>; /** * Use this event to load a display text for the [default choice item](https://surveyjs.io/form-library/documentation/questiondropdownmodel#defaultValue) in [Dropdown](https://surveyjs.io/form-library/documentation/questiondropdownmodel) and [Tag Box](https://surveyjs.io/form-library/documentation/questiontagboxmodel) questions. * * If you load choices from a server (use [`choicesByUrl`](https://surveyjs.io/form-library/documentation/questiondropdownmodel#choicesByUrl) or [`onChoicesLazyLoad`](https://surveyjs.io/form-library/documentation/surveymodel#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. * * For information on event handler parameters, refer to descriptions within the interface. * * [View Demo](https://surveyjs.io/form-library/examples/lazy-loading-dropdown/ (linkStyle)) */ onGetChoiceDisplayValue: EventBase<SurveyModel, GetChoiceDisplayValueEvent>; /** * An event that is raised after a new row is added to a [Dynamic Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdynamic/). */ onMatrixRowAdded: EventBase<SurveyModel, MatrixRowAddedEvent>; /** * An event that is raised before a new row is added to a [Dynamic Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdynamic/). */ onMatrixRowAdding: EventBase<SurveyModel, MatrixBeforeRowAddedEvent>; /** * @deprecated Use the [`onMatrixRowAdding`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onMatrixRowAdding) event instead. */ onMatrixBeforeRowAdded: EventBase<SurveyModel, MatrixBeforeRowAddedEvent>; /** * An event that is raised before a row is deleted from a [Dynamic Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdynamic/). You can cancel row deletion and clear row data instead. * @see onMatrixRenderRemoveButton */ onMatrixRowRemoving: EventBase<SurveyModel, MatrixRowRemovingEvent>; /** * An event that is raised after a row is deleted from a [Dynamic Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdynamic/). * @see onMatrixRenderRemoveButton */ onMatrixRowRemoved: EventBase<SurveyModel, MatrixRowRemovedEvent>; /** * An event that is raised before rendering the Remove button in a row of a [Dynamic Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdynamic/). Use this event to hide the Remove button for individual matrix rows. * @see onMatrixRowRemoving * @see onMatrixRowRemoved */ onMatrixRenderRemoveButton: EventBase<SurveyModel, MatrixAllowRemoveRowEvent>; /** * @deprecated Use the [`onMatrixRenderRemoveButton`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onMatrixRenderRemoveButton) event instead. */ onMatrixAllowRemoveRow: EventBase<SurveyModel, MatrixAllowRemoveRowEvent>; /** * An event that is raised after the visibility of an [expandable detail section](https://surveyjs.io/form-library/examples/add-expandable-details-section-under-matrix-rows/) is changed. This event can be raised for [Multi-Select](https://surveyjs.io/form-library/documentation/api-reference/matrix-table-with-dropdown-list) and [Dynamic Matrix](https://surveyjs.io/form-library/documentation/api-reference/dynamic-matrix-table-question-model) questions. */ onMatrixDetailPanelVisibleChanged: EventBase<SurveyModel, MatrixDetailPanelVisibleChangedEvent>; /** * An event that is raised before a cell in a [Multi-Select Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdropdown/) or [Dynamic Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdynamic/) is created. Use this event to change the type of individual matrix cells. * @see onAfterRenderMatrixCell */ onMatrixCellCreating: EventBase<SurveyModel, MatrixCellCreatingEvent>; /** * An event that is raised after a cell in a [Multi-Select Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdropdown/) or [Dynamic Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdynamic/) is created. * @see onAfterRenderMatrixCell */ onMatrixCellCreated: EventBase<SurveyModel, MatrixCellCreatedEvent>; /** * An event that is raised for every matrix cell after it is rendered to the DOM. * @see onMatrixCellCreated */ onAfterRenderMatrixCell: EventBase<SurveyModel, MatrixAfterCellRenderEvent>; /** * @deprecated Use the [`onAfterRenderMatrixCell`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onAfterRenderMatrixCell) event instead. */ onMatrixAfterCellRender: EventBase<SurveyModel, MatrixAfterCellRenderEvent>; /** * An event that is raised after a cell value is changed in a [Multi-Select Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdropdown/) or [Dynamic Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdynamic/). * @see onMatrixRowAdding */ onMatrixCellValueChanged: EventBase<SurveyModel, MatrixCellValueChangedEvent>; /** * An event that is raised before a cell value is changed in a [Multi-Select Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdropdown/) or [Dynamic Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdynamic/). Use this event to change the cell value. * @see onMatrixRowAdding */ onMatrixCellValueChanging: EventBase<SurveyModel, MatrixCellValueChangingEvent>; /** * An event that is raised for [Multi-Select Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdropdown/) and [Dynamic Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdynamic/) questions when they validate a cell value. Use this event to display a custom error message based on a condition. * @see onMatrixRowAdding */ onMatrixCellValidate: EventBase<SurveyModel, MatrixCellValidateEvent>; /** * An event that is raised after a new column is added to a [Multi-Select Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdropdown/) or [Dynamic Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdynamic/). */ onMatrixColumnAdded: EventBase<SurveyModel, MatrixColumnAddedEvent>; /** * An event that is raised on adding a new item in Multiple Text question. */ onMultipleTextItemAdded: EventBase<SurveyModel, MultipleTextItemAddedEvent>; /** * An event that is raised after a new panel is added to a [Dynamic Panel](https://surveyjs.io/form-library/examples/questiontype-paneldynamic/) question. */ onDynamicPanelAdded: EventBase<SurveyModel, DynamicPanelModifiedEvent>; /** * An event that is raised after a panel is deleted from a [Dynamic Panel](https://surveyjs.io/form-library/examples/questiontype-paneldynamic/) question. */ onDynamicPanelRemoved: EventBase<SurveyModel, DynamicPanelModifiedEvent>; /** * An event that is raised before a panel is deleted from a [Dynamic Panel](https://surveyjs.io/form-library/examples/questiontype-paneldynamic/) question. Use this event to cancel the deletion. */ onDynamicPanelRemoving: EventBase<SurveyModel, DynamicPanelRemovingEvent>; /** * An event that is raised every second while the timer is running. * * Use the [`timeSpent`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#timeSpent) property to find out how many seconds have elapsed. * @see timeLimit * @see timeLimitPerPage * @see showTimer * @see timerLocation * @see startTimer */ onTimerTick: EventBase<SurveyModel, {}>; /** * @deprecated Use the [`onTimerTick`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onTimerTick) event instead. */ onTimer: EventBase<SurveyModel, {}>; onTimerPanelInfoText: EventBase<SurveyModel, any>; /** * An event that is raised after a value is changed in a panel within a [Dynamic Panel](https://surveyjs.io/form-library/examples/questiontype-paneldynamic/) question. */ onDynamicPanelValueChanged: EventBase<SurveyModel, DynamicPanelItemValueChangedEvent>; /** * @deprecated Use the [`onDynamicPanelValueChanged`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onDynamicPanelValueChanged) event instead. */ onDynamicPanelItemValueChanged: EventBase<SurveyModel, DynamicPanelItemValueChangedEvent>; /** * An event that is raised before a value is changed in a panel within a [Dynamic Panel](https://surveyjs.io/form-library/examples/questiontype-paneldynamic/) question. */ onDynamicPanelValueChanging: EventBase<SurveyModel, DynamicPanelValueChangingEvent>; /** * An event that is raised before a [Dynamic Panel](https://surveyjs.io/form-library/examples/questiontype-paneldynamic/) renders [tab titles](https://surveyjs.io/form-library/documentation/api-reference/dynamic-panel-model#templateTabTitle). Use this event to change individual tab titles. * * For information on event handler parameters, refer to descriptions within the interface. * * [View Demo](https://surveyjs.io/form-library/examples/tabbed-interface-for-duplicate-group-option/ (linkStyle)) */ onGetDynamicPanelTabTitle: EventBase<SurveyModel, DynamicPanelGetTabTitleEvent>; /** * An event that is raised after the current panel is changed in a [Dynamic Panel](https://surveyjs.io/form-library/examples/questiontype-paneldynamic/) question. */ onDynamicPanelCurrentIndexChanged: EventBase<SurveyModel, DynamicPanelCurrentIndexChangedEvent>; /** * An event that is raised to define whether a question answer is correct. Applies only to [quiz surveys](https://surveyjs.io/form-library/documentation/design-survey/create-a-quiz). */ onCheckAnswerCorrect: EventBase<SurveyModel, CheckAnswerCorrectEvent>; /** * @deprecated Use the [`onCheckAnswerCorrect`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onCheckAnswerCorrect) event instead. */ onIsAnswerCorrect: EventBase<SurveyModel, IsAnswerCorrectEvent>; /** * An event that is raised when users drag and drop survey elements while designing the survey in [Survey Creator](https://surveyjs.io/survey-creator/documentation/overview). Use this event to control drag and drop operations. * @see isDesignMode */ onDragDropAllow: EventBase<SurveyModel, DragDropAllowEvent>; /** * An event this is raised before a survey element (usually page) is scrolled to the top. Use this event to cancel the scroll operation. */ onScrollToTop: EventBase<SurveyModel, ScrollToTopEvent>; /** * @deprecated Use the [`onScrollToTop`](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#onScrollToTop) event instead. */ onScrollingElementToTop: EventBase<SurveyModel, ScrollingElementToTopEvent>; onLocaleChangedEvent: EventBase<SurveyModel, {}>; /** * An event that allows you to add, delete, or modify actions in a question title. * * For information on event handler parameters, refer to descriptions within the interface. * * [View Demo](https://surveyjs.io/form-library/examples/survey-titleactions/ (linkStyle)) * @see [IAction](https://surveyjs.io/form-library/documentation/api-reference/iaction) */ onGetQuestionTitleActions: EventBase<SurveyModel, GetQuestionTitleActionsEvent>; /** * An event that allows you to add, delete, or modify actions in a panel title. * @see [IAction](https://surveyjs.io/form-library/documentation/api-reference/iaction) */ onGetPanelTitleActions: EventBase<SurveyModel, GetPanelTitleActionsEvent>; /** * An event that allows you to add, delete, or modify actions in a page title. * * For information on event handler parameters, refer to descriptions within the interface. * * [View Demo](https://surveyjs.io/form-library/examples/modify-titles-of-survey-elements/ (linkStyle)) * @see [IAction](https://surveyjs.io/form-library/documentation/api-reference/iaction) */ onGetPageTitleActions: EventBase<SurveyModel, GetPageTitleActionsEvent>; /** * An event that allows you to add, delete, or modify actions in the footer of a [Panel](https://surveyjs.io/form-library/documentation/panelmodel). This panel may belong to a [Dynamic Panel](https://surveyjs.io/form-library/documentation/api-reference/dynamic-panel-model) or be a standalone survey element. * @see [IAction](https://surveyjs.io/form-library/documentation/api-reference/iaction) */ onGetPanelFooterActions: EventBase<SurveyModel, GetPanelFooterActionsEvent>; /** * An event that allows you to add, delete, or modify actions in rows of a [Dynamic Matrix](https://surveyjs.io/form-library/examples/questiontype-matrixdynamic/). * * For information on event handler parameters, refer to descriptions within the interface. * * [View Demo](https://surveyjs.io/form-library/examples/employee-information-form/ (linkStyle)) * @see [IAction](https://surveyjs.io/form-library/documentation/api-reference/iaction) */ onGetMatrixRowActions: EventBase<SurveyModel, GetMatrixRowActionsEvent>; onElementContentVisibilityChanged: EventBase<SurveyModel, any>; /** * An event that is raised before an [Expression](https://surveyjs.io/form-library/documentation/api-reference/expression-model) question displays a value. Use this event to override the display value. */ onGetExpressionDisplayValue: EventBase<SurveyModel, GetExpressionDisplayValueEvent>; /** * An event that is raised after the visibility of a popup is changed. * * This event can be raised for [Single-](https://surveyjs.io/form-library/documentation/api-reference/dropdown-menu-model) and [Multi-Select Dropdown](https://surveyjs.io/form-library/documentation/api-reference/dropdown-tag-box-model) questions and [Rating Scale](https://surveyjs.io/form-library/documentation/api-reference/rating-scale-question-model) questions [rendered as drop-down menus](https://surveyjs.io/form-library/documentation/api-reference/rating-scale-question-model#displayMode), and [Multi-Select Matrix](https://surveyjs.io/form-library/documentation/api-reference/matrix-table-with-dropdown-list) questions that contain columns of the `"dropdown"` or `"tagbox"` [`cellType`](https://surveyjs.io/form-library/documentation/api-reference/matrix-table-with-dropdown-list#cellType). */ onPopupVisibleChanged: EventBase<SurveyModel, PopupVisibleChangedEvent>; /** * An event that is raised when users open a drop-down menu. * *