PopupSurveyModel
A class that renders a survey in a pop-up window.
Inherited from the following class(es):
Properties
Methods
Specifies whether to display a button that closes the pop-up window.
Default value: false
If you allow users to close the pop-up window, make sure to implement a UI element that opens it. This element should call the show() method or enable the isShowing property.
- Type:
- boolean readonly
- Implemented in:
- PopupSurveyModel
- See also:
- expand * , collapse * , hide
Specifies whether to display a button that allows respondents to show the pop-up survey in full screen mode.
Default value: false
- Type:
- boolean readonly
- Implemented in:
- PopupSurveyModel
Creates a new object that has the same type and properties as the current SurveyJS object.
- Type:
- () => Base
- Implemented in:
- Base
Specifies how many seconds the pop-up window should remain open after users complete the survey.
Default value: 0 (the window is closed immediately)
Set this property to a negative value (for instance, -1) to keep the pop-up window open without a time limit.
- Type:
- number readonly
- Implemented in:
- PopupSurveyModel
Collapses the pop-up window, leaving only the survey title visible.
As an alternative to this method, you can set the isExpanded property to false.
- Type:
- () => void
- Implemented in:
- PopupSurveyModel
- See also:
- expand
Expands the pop-up window.
As an alternative to this method, you can set the isExpanded property to true.
- Type:
- () => void
- Implemented in:
- PopupSurveyModel
- See also:
- collapse
Assigns a new JSON schema to the current survey element.
The JSON schema should contain only serializable properties of this survey element. Event handlers and properties that do not belong to the survey element are ignored.
- Type:
- (json: any, options?: ILoadFromJSONOptions) => void
- Parameters:
-
json, type: any ,
A JSON schema that you want to apply to the current survey element.
options, type: ILoadFromJSONOptions ,An object with configuration options.
options.validatePropertyValues, type: boolean ,Pass
trueif you want to validate property values. Use thejsonErrorsarray to access validation errors.
- Implemented in:
- Base
- See also:
- toJSON
Returns a JSON schema that contains only locale strings and the minimal set of properties required to identify survey elements.
This method is syntactic sugar for calling the toJSON() method with the storeLocaleStrings option set to "stringsOnly".
To apply a locale-strings-only schema to a survey model, call the mergeLocalizationJSON(json, locales) method.
- Type:
- (locales?: string[]) => any
- Parameters:
-
locales, type: string[] ,
(Optional) An array of locale identifiers to include in the JSON schema.
- Return Value:
-
A locale-strings-only JSON schema.
- Implemented in:
- Base
Returns the survey element that owns this element. Returns undefined if called on a SurveyModel instance.
- Type:
- () => any
- Return Value:
-
The owner survey element, or
undefinedif none exists.
- Implemented in:
- Base
Returns a JsonObjectProperty object with metadata about a serializable property that belongs to the current SurveyJS object.
If the property is not found, this method returns null.
- Type:
- (propName: string) => JsonObjectProperty
- Parameters:
-
propName, type: string ,
A property name.
- Implemented in:
- Base
Returns the value of a property with a specified name.
If the property is not found or does not have a value, this method returns either undefined, defaultValue specified in the property configuration, or a value passed as the defaultValue parameter.
- Type:
- (name: string, defaultValue?: any, calcFunc?: () => any) => any
- Parameters:
-
name, type: string ,
A property name.
defaultValue, type: any ,(Optional) A value to return if the property is not found or does not have a value.
calcFunc, type: () => any
- Implemented in:
- Base
Hides the pop-up survey.
As an alternative to this method, you can set the isShowing property to false.
- Type:
- () => void
- Implemented in:
- PopupSurveyModel
Returns true if the object is included in a survey.
This property may return false, for example, when you create a survey model dynamically.
- Type:
- boolean readonly
- Implemented in:
- Base
Returns true if the survey is being designed in Survey Creator.
- Type:
- boolean readonly
- Implemented in:
- Base
Indicates whether the pop-up window is expanded or collapsed.
You can set this property to true or false to control the expand state of the pop-up survey. Alternatively, you can use the expand() and collapse() methods.
- Type:
- boolean readonly
- Implemented in:
- PopupSurveyModel
Returns true if the object configuration is being loaded from JSON.
- Type:
- boolean readonly
- Implemented in:
- Base
Returns true if the survey element is a page.
This property returns false for PageModel objects in the following cases:
SurveyModel'squestionsOnPageModeis set to"singlePage".- The page is included in a preview of given answers.
In those cases, the survey creates an internal PageModel object to show all questions on one page, and all regular pages become panels.
- Type:
- boolean readonly
- Implemented in:
- Base
Returns true if the survey element is a panel or acts as one.
This property returns true for PageModel objects in the following cases:
SurveyModel'squestionsOnPageModeis set to"singlePage".- The page is included in a preview of given answers.
In those cases, the survey creates an internal PageModel object to show all questions on one page, and all regular pages become panels.
- Type:
- boolean readonly
- Implemented in:
- Base
Indicates whether the pop-up survey appears on the page, regardless of its expand state.
You can set this property to true or false to control visibility of the pop-up survey. Alternatively, you can use the show() and hide() methods.
- Type:
- boolean readonly
- Implemented in:
- PopupSurveyModel
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. Passfalseto disable this functionality.
- Implemented in:
- Base
An event that is raised when an ItemValue property is changed.
Parameters:
sender:this
A SurveyJS object whose property contains an array ofItemValueobjects.options.obj:ItemValue
AnItemValueobject.options.propertyName:string
The name of the property to which an array ofItemValueobjects is assigned (for example,"choices"or"rows").options.name:"text"|"value"
The name of the changed property.options.newValue:any
A new value for the property.
- Type:
- Event<(sender: Base, options: any) => any, Base, any>
- Implemented in:
- Base
An event that is raised when a property of this SurveyJS object has changed.
Parameters:
sender:this
A SurveyJS object whose property has changed.options.name:string
The name of the changed property.options.newValue:any
A new value for the property.options.oldValue:any
An old value of the property. If the property is an array,oldValuecontains the same array asnewValuedoes.
If you need to add and remove property change event handlers dynamically, use the registerPropertyChangedHandlers and unregisterPropertyChangedHandlers methods instead.
- Type:
- EventBase<Base, any>
- Implemented in:
- Base
Registers a single value change handler for one or multiple properties.
The registerPropertyChangedHandlers and unregisterPropertyChangedHandlers methods allow you to manage property change event handlers dynamically. If you only need to attach an event handler without removing it afterwards, you can use the onPropertyChanged event instead.
- Type:
- (propertyNames: string[], handler: any, key?: string) => void
- Parameters:
-
propertyNames, type: string[] ,
An array of one or multiple property names.
handler, type: any ,A function to call when one of the listed properties change. Accepts a new property value as an argument.
key, type: string ,(Optional) A key that identifies the current registration. If a function for one of the properties is already registered with the same key, the function will be overwritten. You can also use the key to subsequently unregister handlers.
- Implemented in:
- Base
- See also:
- unregisterPropertyChangedHandlers
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
Shows the pop-up survey. The survey may appear expanded or collapsed.
As an alternative to this method, you can set the isShowing property to true.
- Type:
- () => void
- Implemented in:
- PopupSurveyModel
- See also:
- hide
A SurveyModel instance rendered in the pop-up window.
- Type:
- SurveyModel readonly
- Implemented in:
- PopupSurveyModel
A title for the pop-up window. If this property is undefined, the title is taken from SurveyModel's title property.
- Type:
- string writable
- Implemented in:
- PopupSurveyModel
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
Validates expressions used in the survey.
This method detects the following types of errors:
Unknown variable
The expression references an undefined variable or an unknown question, panel, or page name.Unknown function
The expression references an unregistered function.Semantic error
The expression is syntactically valid but has no meaningful effect because it always evaluates to the same value.Syntax error
The expression contains invalid syntax, such as unmatched parentheses, missing operands, or invalid operators.
You can disable checks for unknown variables, unknown functions, and semantic errors by passing an options object with the variables, functions, or semantics property set to false. Syntax errors are always validated.
// ...
// Omitted: `SurveyModel` creation
// ...
// Validate syntax errors only
const res = survey.validateExpressions({
variables: false,
functions: false,
semantics: false
});
- Type:
- (options?: IExpressionValidationOptions) => IExpressionValidationResult[]
- Parameters:
-
options, type: IExpressionValidationOptions ,
Configuration options that control which validation checks are performed.
options.variables, type: boolean ,Pass
falseto disable validation of unknown variables.options.functions, type: boolean ,Pass
falseto disable validation of unknown functions.options.semantics, type: boolean ,Pass
falseto disable validation of semantic errors.
- Return Value:
-
An
IExpressionValidationResultarray.
- Implemented in:
- Base
Send feedback to the SurveyJS team
Need help? Visit our support page