question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

An event after survey validate the questions on the current page is missed

See original GitHub issue

Are you requesting a feature, reporting a bug or asking a question?

I’m reporting a bug.

What is the current behavior?

Accessing surveyModel.isCurrentPageHasErrors will cause onErrorCustomText events to be fired for each error on the page.

What is the expected behavior?

The documentation says that isCurrentPageHasErrors is a readonly property. I would expect that accessing a property doesn’t fire events, potentially triggering side-effects that I’ve added to these events.

How would you reproduce the current behavior (if this is a bug)?

Add a console.log to onErrorCustomText and then access isCurrentPageHasErrors from any event such as onAfterRenderSurvey.

Provide the test code and the tested page URL (if applicable)

Run the below code and open the console.

If there are two questions on the first page of the survey, onErrorCustomText will fire twice.

Test code

import React from 'react';
import { Model, Survey } from 'survey-react';
import { mockData } from '../lib/mockData';

export class SurveyTest extends React.Component {
    public render() {
        return <Survey 
            json={mockData} 
            onErrorCustomText={this.onErrorCustomText} 
            onAfterRenderSurvey={this.onAfterRenderSurvey}
        />
    }

    private onErrorCustomText = () => {
        console.log('onErrorCustomText');
    };

    private onAfterRenderSurvey = (s: typeof Model) => {
        s.isCurrentPageHasErrors;
    }
}

Specify your

  • browser: Chrome
  • browser version: 73.0.3683.103 (Official Build) (64-bit)
  • surveyjs platform (angular or react or jquery or knockout or vue): react
  • surveyjs version: 1.0.78

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
andrewtelnovcommented, Apr 13, 2019

@zhihil I have a new event, onValidatedErrorsOnCurrentPage. It fires after question validation on the current page. You may look at my unit test to find out how it works.

It will be available in the next minor update, that we will release on the next week. You may build the library from source. The instruction for building library from source in the Readme file.

Let me know if it works.

Thank you, Andrew

0reactions
andrewtelnovcommented, Apr 15, 2019

Great!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Response Requirements & Validation - Qualtrics
Response requirements & validation are used to alert respondents about questions they may have missed, or they can be used to solicit a...
Read more >
Post-Event Survey Questions for Your Next ... - SurveyMonkey
Check out this entertainment event feedback survey template to help you find questions that may improve presentations and performances for your next event....
Read more >
Standards and Guidelines for Statistical Surveys - SAMHSA
Within this framework, the 20 standards and their related guidelines for Federal statistical surveys focus on ensuring high quality statistical surveys that ...
Read more >
Question validation in surveys - QuestionPro
Question validation can also let the survey administrators configure the study to request the participants to respond if they missed it.
Read more >
Surveys | University of North Dakota
From the Projects page, open the Survey tab in any one of three ways: ... The following validation types are available for all...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found