diff --git a/nodes/widgets/ui_form.js b/nodes/widgets/ui_form.js index df31e3b7c..647c26968 100644 --- a/nodes/widgets/ui_form.js +++ b/nodes/widgets/ui_form.js @@ -1,3 +1,4 @@ +const datastore = require('../store/data.js') const statestore = require('../store/state.js') module.exports = function (RED) { @@ -13,6 +14,11 @@ module.exports = function (RED) { const evts = { onAction: true, beforeSend: function (msg) { + if (msg?._event === 'submit') { + if (config.topicType === 'msg') { + msg.topic = datastore.get(node.id)?.[config.topic] || '' + } + } if (msg.ui_update) { const update = msg.ui_update if (typeof update.label !== 'undefined') { diff --git a/ui/src/widgets/ui-form/UIForm.vue b/ui/src/widgets/ui-form/UIForm.vue index e61938643..0a7159ed0 100644 --- a/ui/src/widgets/ui-form/UIForm.vue +++ b/ui/src/widgets/ui-form/UIForm.vue @@ -127,7 +127,8 @@ export default { }) this.$socket.emit('widget-action', this.id, { - payload: this.input + payload: this.input, + _event: 'submit' }) if (this.props.resetOnSubmit) { this.reset()