Skip to content

Commit 9c2f8e0

Browse files
PS-279 [FIX] Ensures the default value is available for the user when the List of Values is configured. (#726)
1 parent 11e4297 commit 9c2f8e0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

js/components/typeahead.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ Fliplet.FormBuilder.field('typeahead', {
7373
return rules;
7474
},
7575
created: function() {
76+
if (!!this.defaultValue && this.optionsType === 'manual') {
77+
this.value = this.defaultValue.split(/\n/);
78+
this.updateValue(this.name, this.value);
79+
} else if (!Array.isArray(this.value) && this.optionsType === 'manual') {
80+
this.value = [];
81+
this.updateValue(this.name, this.value);
82+
}
83+
7684
Fliplet.Hooks.on('beforeFormSubmit', this.onBeforeSubmit);
7785
},
7886
destroyed: function() {

0 commit comments

Comments
 (0)