Bug 35280: Fix patron attributes "clear" link in OPAC patron entry form

This patch makes a minor correction to the JavaScript controlling the
behavior of the "clear" link which appears on the patron entry form next
to patron attribute <select>s or <textarea>s which are editable in the
OPAC.

To test, apply the patch and create patron attributes
which have both "Display in OPAC" and "Editable in OPAC" checked.

- Create one which is tied to an authorized value, and one which isn't.
- Log in to the OPAC and click the "Personal details" tab.
- In the entry form, find the patron attribute fields under the
  Additional information" heading..
- Select a value in the dropdown, and enter text in the textarea.
- Confirm that clicking the corresponding "Clear" link for each works as
  expected.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Owen Leonard 2023-11-07 17:07:17 +00:00 committed by Tomas Cohen Arazi
parent b5d174c7d9
commit 3a027a0da9
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 4 additions and 5 deletions

View File

@ -1199,12 +1199,11 @@
[% END %]
[% END %]
$(".patron-attributes").on( 'click', '.clear-attribute', function() {
$(".patron-attributes").on( 'click', '.clear-attribute', function(e) {
e.preventDefault();
$(this).parent()
.find('textarea').attr('value', '').end()
.find('select').attr('value', '').end();
return false;
.find('textarea').val("").end()
.find('select').val("").end();
} );
$(".patron-attributes").on( 'click', '.clone-attribute', function() {