-
Notifications
You must be signed in to change notification settings - Fork 902
Description
Describe the bug
The new SurveyModel.validateExpressions() API can return the ExpressionValidator object in IExpressionValidationResult.obj, but the documentation and TypeScript typings state that this value should be a survey element (question, panel, page, or survey).
Additionally, the documentation example does not compile in TypeScript because it accesses a non-existent name property on Base.
I took the example from - https://surveyjs.io/stay-updated/release-notes/v2.5.7
const results = survey.validateExpressions();
results.forEach(result => {
const element = result.obj;
console.warn(
`Expression error in "${element.name}", property "${result.propertyName}":`,
result.errors
);
});export interface IExpressionValidationResult {
obj: Base;
propertyName: string;
errors: IExpressionError[];
}At runtime, result.obj is not a survey element. It is an internal validator instance:
Expected behavior
Return the owning survey element when validators[] is used
result.obj should be the Question | Panel | Page | Survey that contains the expression
- Browser: chrome
- Browser version: 143.0.7499.192 (Official Build) (64-bit)
- JS framework/library: React
- SurveyJS version: v2.5.7
- Device: PC
The current behaviour makes it difficult to display meaningful validation messages (e.g., element name) without relying on undocumented internal fields.