From 06bdbbb02ea064b6a1c1db8508f104eb8d8f9cb4 Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Fri, 2 May 2025 10:11:02 +0200 Subject: [PATCH] change value of input element only when opening the edit updates do not need to update them (not yet done for enum and checkbox) --- client/jsFiles/SEAWebClientCommunication.js | 11 +---------- client/jsFiles/SEAWebClientGroup.js | 5 +++++ 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/client/jsFiles/SEAWebClientCommunication.js b/client/jsFiles/SEAWebClientCommunication.js index 6f6233a..3c89899 100644 --- a/client/jsFiles/SEAWebClientCommunication.js +++ b/client/jsFiles/SEAWebClientCommunication.js @@ -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") { diff --git a/client/jsFiles/SEAWebClientGroup.js b/client/jsFiles/SEAWebClientGroup.js index ed78cfe..b2f221f 100644 --- a/client/jsFiles/SEAWebClientGroup.js +++ b/client/jsFiles/SEAWebClientGroup.js @@ -239,6 +239,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'); @@ -324,6 +328,7 @@ function createInputText(component) { }; form.appendChild(input); form.appendChild(createSubmitButton()); + form.inputChild = input; return form; }