Question T2012
Visible to All Users

Show errors validations

created 6 years ago

Hello good afternoon.

Can you help me?

I need to do validations by type of question in the survey editor.

Then show those validation errors when you press the save button in the editor before sending the survey to my server.

Is it possible to do this?

Answers approved by surveyjs Support

created 6 years ago

Hello,
I believe, you are using Survey Creator on your web application and saving the survey in your own database, using your own code.
It means that you may do validation just before calling the function that saves the survey in your database.
The following code will return you all questions in the survey: surveyCreator.survey.getAllQuestions();

Thank you,
Andrew
SurveyJS Team

    Comments (2)

      I need the following
      1.PNG

      Get all the errors as shown in the previous image.
      when the survey save button is pressed.
      Is it possible with this?
      surveyCreator.survey.getAllQuestions();

        Hello,
        Please use the following event: surveyCreator.onPropertyValidationCustomError.

        JavaScript
        surveyCreator.onPropertyValidationCustomError.add(function(sender, options) { if(options.propertyName !== "myPropertyName") return; if(options.value == "wrong value") { options.error = "The value is incorrect"; } });

        Thank you,
        Andrew
        SurveyJS Team