Skip to content

Commit 1fb2258

Browse files
authored
Allow for value to also be a boolean or a number (#135)
* Allow for value to also be a boolean or a number * Update value types and validation
1 parent eddb775 commit 1fb2258

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/components/Question.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
props: {
129129
question: QuestionModel,
130130
language: LanguageModel,
131-
value: [String, Array],
131+
value: [String, Array, Boolean, Number],
132132
active: {
133133
type: Boolean,
134134
default: false

src/components/QuestionTypes/BaseType.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
language: LanguageModel,
1818
question: QuestionModel,
1919
active: Boolean,
20-
value: [String, Array]
20+
value: [String, Array, Boolean, Number]
2121
},
2222
mixins: [
2323
IsMobile,
@@ -162,10 +162,12 @@
162162
let v = this.dataValue
163163
164164
if (v.trim) {
165-
v = v.trim()
165+
// Don't allow empty strings
166+
return v.trim().length > 0
166167
}
167168
168-
return v.length > 0
169+
// All other non-null values are allowed to pass through
170+
return true
169171
}
170172
171173
return false

0 commit comments

Comments
 (0)