This commit is contained in:
Martin Edenhofer 2018-02-16 10:35:50 +01:00
parent db8b54f64c
commit 894afeeb42
2 changed files with 8 additions and 8 deletions

View file

@ -460,16 +460,16 @@ class App.ControllerForm extends App.Controller
checked = $(@).attr('checked')
name = $(@).attr('name')
if name && !checked && (!(name of param) || param[name] is '')
if uncheckParam[name] is ''
uncheckParam[name] = []
if !(name of uncheckParam)
uncheckParam[name] = undefined
else
uncheckParam[name] = ''
uncheckParam[name] = []
)
lookupForm.find('input[type=radio]').each( (index) ->
checked = $(@).attr('checked')
name = $(@).attr('name')
if name && !checked && !(name of param)
uncheckParam[name] = ''
uncheckParam[name] = undefined
)
for key, value of uncheckParam
if !(key of param)

View file

@ -143,9 +143,9 @@ test("form params check", function() {
active1: true,
active2: false,
checkbox1: [],
checkbox2: '',
checkbox2: undefined,
checkbox3: 'd',
radiobox1: '',
radiobox1: undefined,
radiobox2: 'a',
}
new App.ControllerForm({
@ -291,10 +291,10 @@ test("form params check", function() {
active1: true,
active2: false,
checkbox1: [],
checkbox2: '',
checkbox2: undefined,
checkbox3: 'd',
checkbox4: [],
radiobox1: '',
radiobox1: undefined,
radiobox2: 'a',
}
deepEqual(params, test_params, 'form param check')