change value of input element only when opening the edit

updates do not need to update them
(not yet done for enum and checkbox)
This commit is contained in:
2025-05-02 10:11:02 +02:00
parent 7898e375b4
commit 0f16699323
2 changed files with 6 additions and 10 deletions

View File

@ -282,19 +282,10 @@ function updateValue(component) {
if (text) {
elem.innerHTML = text;
}
}
}
else if (type == "input") {
let row = elem.closest('div');
row.classList.remove('row-waiting-for-answer');
let oldValue = ('oldValue' in elem) ? elem.oldValue : elem.value;
if (component.value != elem.value && parseFloat(component.value) != parseFloat(elem.value) && component.value != oldValue) {
if (elem == document.activeElement || oldValue != elem.value) {
row.classList.add('row-waiting-for-answer');
} else {
elem.value = component.value;
}
}
elem.actualValue = component.value;
resizeTextfield(elem);
} else if (type == "checkbox") {

View File

@ -242,6 +242,10 @@ function createIconEdit (input_element) {
hideInputElements();
if (is_hidden) {
input_element.classList.remove('input-element-hidden');
if (input_element.inputChild) {
// update input value before edit
input_element.inputChild.value = input_element.inputChild.actualValue;
}
icon_edit.setAttribute('src', 'res/icon_edit_close.png');
} else {
icon_edit.setAttribute('src', 'res/icon_edit.png');
@ -327,6 +331,7 @@ function createInputText(component) {
};
form.appendChild(input);
form.appendChild(createSubmitButton());
form.inputChild = input;
return form;
}