close #1551 Fixed: Reconciliation form checkbox missing values

This commit is contained in:
Cüneyt Şentürk
2020-08-10 14:15:15 +03:00
parent 115b55f688
commit 48a37246c5
5 changed files with 33 additions and 3 deletions

View File

@ -48,9 +48,35 @@ export default class Form {
this[form_element.getAttribute('data-field')] = field;
}
/*
if (!this[form_element.getAttribute('data-field')][name]) {
this[form_element.getAttribute('data-field')][name] = '';
}
*/
if (type == 'radio') {
if (!this[form_element.getAttribute('data-field')][name]) {
this[form_element.getAttribute('data-field')][name] = (form_element.getAttribute('value') ? 1 : 0) || 0;
}
} else if (type == 'checkbox') {
if (this[form_element.getAttribute('data-field')][name]) {
if (!this[form_element.getAttribute('data-field')][name].push) {
this[form_element.getAttribute('data-field')][name] = [this[form_element.getAttribute('data-field')][name]];
}
if (form_element.checked) {
this[form_element.getAttribute('data-field')][name].push(form_element.value);
}
} else {
if (form_element.checked) {
this[form_element.getAttribute('data-field')][name] = form_element.value;
} else {
this[form_element.getAttribute('data-field')][name] = [];
}
}
} else {
this[form_element.getAttribute('data-field')][name] = form_element.getAttribute('value') || '';
}
continue;
}