Skip to content

Commit dde0a7d

Browse files
committed
fix validation when "none" selected
1 parent be6bfd7 commit dde0a7d

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

nodes/widgets/ui_audio.html

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,39 @@
1313
defaults: {
1414
group: {
1515
type: 'ui-group',
16-
validate: function (v) {
17-
const mode = $('#node-input-mode').val() || this.mode || 'src'
18-
return mode === 'tts' ? true : (v !== null && v !== undefined && v !== '')
16+
validate: function () {
17+
const tempScope = ($('#node-input-mode').val() !== undefined) ? $('#node-input-mode').val() : this.mode || 'src'
18+
const groupVal = ($('#node-input-group').val() !== undefined) ? $('#node-input-group').val() : this.group
19+
20+
if (tempScope !== 'src') {
21+
return true
22+
}
23+
24+
if (tempScope === 'src') {
25+
if (!!groupVal && groupVal !== '_ADD_') {
26+
return true
27+
}
28+
}
29+
return false
1930
}
31+
2032
},
2133
ui: {
2234
type: 'ui-base',
2335
validate: function (v) {
24-
const mode = $('#node-input-mode').val() || this.mode || 'src'
25-
return mode === 'tts' ? (v !== null && v !== undefined && v !== '') : true
36+
const tempScope = ($('#node-input-mode').val() !== undefined) ? $('#node-input-mode').val() : this.mode || 'src'
37+
const uiVal = ($('#node-input-ui').val() !== undefined) ? $('#node-input-ui').val() : this.ui
38+
39+
if (tempScope !== 'tts') {
40+
return true
41+
}
42+
43+
if (tempScope === 'tts') {
44+
if (!!uiVal && uiVal !== '_ADD_') {
45+
return true
46+
}
47+
}
48+
return false
2649
}
2750
},
2851
name: { value: '' },

0 commit comments

Comments
 (0)