Skip to content

Commit 49d6d8c

Browse files
authored
Merge pull request #93 from solid/fix/booleanfield
Do not prefill a value for a checkbox
2 parents 110c54d + 9a4046d commit 49d6d8c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/widgets/forms.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,20 +1202,22 @@ function buildCheckboxForm (dom, kb, lab, del, ins, form, store, tristate) { //
12021202
}
12031203
function refresh () {
12041204
var state = holdsAll(ins)
1205+
var displayState = state
12051206
if (del.length) {
12061207
var negation = holdsAll(del)
12071208
if (state && negation) {
1208-
box.appendChild(error.errorMessageBlock(dom,
1209+
box.appendChild(UI.widgets.errorMessageBlock(dom,
12091210
'Inconsistent data in store!\n' + ins + ' and\n' + del))
12101211
return box
12111212
}
12121213
if (!state && !negation) {
1214+
state = null
12131215
let defa = kb.any(form, UI.ns.ui('default'))
1214-
state = defa ? defa.value === '1' : tristate ? null : false
1216+
displayState = defa ? defa.value === '1' : tristate ? null : false
12151217
}
12161218
}
12171219
input.state = state
1218-
input.textContent = {true: checkMarkCharacter, false: cancelCharacter, null: dashCharacter}[input.state]
1220+
input.textContent = {true: checkMarkCharacter, false: cancelCharacter, null: dashCharacter}[displayState]
12191221
}
12201222

12211223
refresh()

0 commit comments

Comments
 (0)