Skip to content

Commit 3fedfcd

Browse files
committed
Fix validation when the mask is an array
1 parent 301bbd2 commit 3fedfcd

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/components/QuestionTypes/TextType.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
4949
import BaseType from './BaseType.vue'
5050
import { QuestionType } from '../../models/QuestionModel'
51-
import LanguageModel from '../../models/LanguageModel'
5251
import TheMask from 'vue-the-mask/src/component'
5352
5453
export default {
@@ -67,8 +66,12 @@
6766
6867
methods: {
6968
validate() {
70-
if (this.question.mask && this.hasValue && this.dataValue.length !== this.question.mask.length) {
71-
return false
69+
if (this.question.mask && this.hasValue) {
70+
if (Array.isArray(this.question.mask)) {
71+
return this.question.mask.some(mask => mask.length === this.dataValue.length)
72+
}
73+
74+
return this.dataValue.length !== this.question.mask.length
7275
}
7376
7477
return !this.question.required || this.hasValue

0 commit comments

Comments
 (0)