Question T7505
Visible to All Users

Show error message on matrixdynamic columns

created 3 years ago

Hello,

I have added requiredIf condition in matrix columns that if 1 column is answered, then the other 3 are mandatory to be answered. On clicking Complete in Plunkr, the 'onComplete' event internally checks for these validations and gives error messages right on top of the cells. Clipboard-File-1.png

I need to show similar messages on my custom events. How can I achieve the same?

Answers approved by surveyjs Support

created 3 years ago

Hello,

You can call the https://surveyjs.io/Documentation/Library?id=pagemodel#hasErrors method of a current page:

JavaScript
survey.currentPage.hasErrors(true, true);

Thanks, Serge
SurveyJS Team

    Comments (2)

      I have added validations on different columns/fields in json, which is being triggered on 'onComplete' event in Plunkr. Since I have my custom actions in my project, is there a way to trigger all validations manually?

        Hello,

        The call

        JavaScript
        survey.currentPage.hasErrors(true, true);

        triggers validation for all questions on the current page and shows errors.
        You can make this call in any part of your code according your needs, from custom actions as well.

        In case of misunderstanding could you describe your case in greater details?

        Thanks, Serge
        SurveyJS Team