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') checked = $(@).attr('checked')
name = $(@).attr('name') name = $(@).attr('name')
if name && !checked && (!(name of param) || param[name] is '') if name && !checked && (!(name of param) || param[name] is '')
if uncheckParam[name] is '' if !(name of uncheckParam)
uncheckParam[name] = [] uncheckParam[name] = undefined
else else
uncheckParam[name] = '' uncheckParam[name] = []
) )
lookupForm.find('input[type=radio]').each( (index) -> lookupForm.find('input[type=radio]').each( (index) ->
checked = $(@).attr('checked') checked = $(@).attr('checked')
name = $(@).attr('name') name = $(@).attr('name')
if name && !checked && !(name of param) if name && !checked && !(name of param)
uncheckParam[name] = '' uncheckParam[name] = undefined
) )
for key, value of uncheckParam for key, value of uncheckParam
if !(key of param) if !(key of param)

View file

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