Bug 28297: Allow syspref text fields to be saved when content changed to original value

This fixes the behavior on changed system preferences in HTML input text fields. Preferences which are changed back to the original value can be saved now without reloading the system pref page.
This will only affect input fields with type=text as they have the property defaultValue which is checked to highlight a field as 'modified'.

Testplan:
a) take a syspref with an HTML text input field f.e. AccessControlAllowOrigin
b) write '*' into the iput field. Notice that the preference is marked 'modified'. Click 'save'
c) now got to the text field again and delete that '*'. Notice the preference does not get marked as modified and can theefore not be saved.
d) apply patch and reload page
e) repeat b) and c) and notice that the preference gets marked 'modified' on both cases.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 581c9b39bb)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
This commit is contained in:
Jan Kissig 2026-03-17 09:32:52 +00:00 committed by Jacob O'Mara
parent 663d263c17
commit 405b8ade7f
No known key found for this signature in database
1 changed files with 4 additions and 0 deletions

View File

@ -68,6 +68,10 @@ KOHA.Preferences = {
$(form)
.find(".modified")
.each(function () {
// set defaultValue to changed value - enables re-saving when input changes back to initial value
if (this.defaultValue != undefined) {
this.defaultValue = this.value;
}
var modified_pref = $(this).attr("id");
modified_pref = modified_pref.replace("pref_", "");
msg +=