Commit 31dd958a authored by Oliver Hader's avatar Oliver Hader Committed by Tobi Kretschmann
Browse files

Revert "[TASK] Keep old value on confirmation modal close"

This reverts commit c529deac.

The patch only addressed a single use-case. In favour of a more
generic approach mentioned change has been reverted.

Reverts: #89220
Resolves: #89362
Releases: master, 9.5
Change-Id: I30900d1b80268b263a47ba1c261904f7caa63710
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61913

Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: default avatarSascha Rademacher <sascha.rademacher+typo3@gmail.com>
Tested-by: default avatarTobi Kretschmann <tobi@tobishome.de>
Reviewed-by: default avatarSascha Rademacher <sascha.rademacher+typo3@gmail.com>
Reviewed-by: default avatarTobi Kretschmann <tobi@tobishome.de>
parent 660c6514
......@@ -193,7 +193,6 @@ class SelectSingleElement extends AbstractFormElement
'name' => $parameterArray['itemFormElName'],
'data-formengine-validation-rules' => $this->getValidationDataAsJsonString($config),
'class' => implode(' ', $classList),
'data-original-value' => $selectedValue,
];
if ($size) {
$selectAttributes['size'] = $size;
......
......@@ -911,34 +911,20 @@ define(['jquery',
FormEngine.requestConfirmationOnFieldChange = function(fieldName, showConfirmation) {
const $field = FormEngine.getFieldElement(fieldName);
$field.on('change', function() {
const originalValue = $field.data('original-value');
let documentUpdated = false;
if (showConfirmation) {
if ($field.val() != originalValue) {
const $modal = Modal.confirm(
TYPO3.lang['FormEngine.refreshRequiredTitle'],
TYPO3.lang['FormEngine.refreshRequiredContent']
);
const $modal = Modal.confirm(
TYPO3.lang['FormEngine.refreshRequiredTitle'],
TYPO3.lang['FormEngine.refreshRequiredContent']
);
$modal.on('button.clicked', function(e) {
if (e.target.name === 'ok') {
FormEngine.saveDocument();
documentUpdated = true
}
Modal.dismiss();
});
$modal.on('hide.bs.modal', function(e) {
// Revert to previous value if document is not saved.
// Trigger js event to update icon in custom select input.
if (!documentUpdated && originalValue) {
$field.val(originalValue);
$field.trigger('change');
}
});
}
$modal.on('button.clicked', function(e) {
if (e.target.name === 'ok') {
FormEngine.saveDocument();
}
Modal.dismiss();
});
} else {
FormEngine.saveDocument();
}
......
......@@ -545,12 +545,7 @@ define([
*/
FormEngineValidation.markFieldAsChanged = function($field) {
var $paletteField = $field.closest('.t3js-formengine-palette-field');
if ($field.data('original-value') && $field.data('original-value') == $field.val()) {
$paletteField.removeClass('has-change');
} else {
$paletteField.addClass('has-change');
}
$paletteField.addClass('has-change');
};
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment