Page MenuHomePhorge

D1738.1775204420.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D1738.1775204420.diff

diff --git a/src/resources/vue/Widgets/ListInput.vue b/src/resources/vue/Widgets/ListInput.vue
--- a/src/resources/vue/Widgets/ListInput.vue
+++ b/src/resources/vue/Widgets/ListInput.vue
@@ -28,13 +28,15 @@
id: { type: String, default: '' }
},
methods: {
- addItem() {
- let input = $(this.$el).find('.main-input')
- let value = input.val()
+ addItem(focus) {
+ let value = this.input.value
if (value) {
this.list.push(value)
- input.val('').focus()
+ this.input.value = ''
+ if (focus !== false) {
+ this.input.focus()
+ }
}
},
deleteItem(index) {
@@ -50,6 +52,18 @@
e.preventDefault()
}
}
+ },
+ mounted() {
+ this.input = $(this.$el).find('.main-input')[0]
+
+ // On form submit add the text from main input to the list
+ // Users tend to forget about pressing the "plus" button
+ // Note: We can't use form.onsubmit (too late)
+ // Note: Use of input.onblur has been proven to be problematic
+ // TODO: What with forms that have no submit button?
+ $(this.$el).closest('form').find('button[type=submit]').on('click', () => {
+ this.addItem(false)
+ })
}
}
</script>

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 3, 8:20 AM (44 m, 45 s ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18779958
Default Alt Text
D1738.1775204420.diff (1 KB)

Event Timeline