diff --git a/src/validator.ts b/src/validator.ts index d916991be6..98bb7b4cdf 100644 --- a/src/validator.ts +++ b/src/validator.ts @@ -315,6 +315,7 @@ export class AnswerCountValidator extends SurveyValidator { ): ValidatorResult { if (value == null || value.constructor != Array) return null; var count = value.length; + if (count == 0) return null; if (this.minCount && count < this.minCount) { return new ValidatorResult( null, diff --git a/tests/surveyquestiontests.ts b/tests/surveyquestiontests.ts index a9326b6107..cae0566c3a 100644 --- a/tests/surveyquestiontests.ts +++ b/tests/surveyquestiontests.ts @@ -990,6 +990,10 @@ QUnit.test("Validators for other values - checkbox, Bug #722", function( true, "There should be at least 2 values selected" ); + question.value = []; + assert.equal(question.hasErrors(), false, "We do not check the empty array"); + question.value = undefined; + assert.equal(question.hasErrors(), false, "We do not check the empty value"); }); QUnit.test( "other values in choices, hasOther=false, Bug(Editor) #242",