Bug 27703

Summary: Can't navigate in Authorized values
Product: Koha Reporter: Séverine Queune <severine.queune>
Component: System AdministrationAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: andrew, david, fridolin.somers, gmcharlt, jonathan.druart, martin.renvoize, victor
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27713
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This fixes an issue when navigating authorized value categories - if you selected an authorized value category from the drop down list it wouldn't change to the selected category.
Version(s) released in:
21.05.00,20.11.04,20.05.10
Circulation function:
Bug Depends on: 25954    
Bug Blocks:    
Attachments: Bug 27703: Make ID of category select field unique
Bug 27703: Make ID of category select field unique
Bug 27703: Make ID of category select field unique
Bug 27703: Make ID of category select field unique

Description Séverine Queune 2021-02-15 07:59:55 UTC
When you are seeing a specific authorized value, it's no longer possible to go to another authorized value using the drop-down menu "Show category".
Comment 1 Jonathan Druart 2021-02-15 14:46:54 UTC
Hi Séverine, can you be more specific?

I am seeing the "Show category" on this view https://snipboard.io/Cda091.jpg

Do you mean when we edit an authorised value?
Comment 2 Séverine Queune 2021-02-15 15:45:07 UTC
Hi Jonathan !
Here is a capture made a few minutes ago on Biblibre's sandbox #1 :
https://prnt.sc/zmai4z
When I select a new category in the menu, it doesn't change.
When the page is slow to charge, I can see a "Submit" button that finally disappear.
Comment 3 Jonathan Druart 2021-02-15 16:18:00 UTC
Caused by 

  commit 38bc9eb2a8c01c8625b1c33c7e098cd0022b2710
  Bug 25954: Replace paragraph tags with labels in header search forms

Owen, can you have a look please? There are 2 elements with id=searchfield on this page.
Comment 4 Jonathan Druart 2021-02-15 16:19:40 UTC
This occurrence might be problematic as well:

koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt:        <input type="text" name="searchfield" id="searchfield" size="4" value="[% searchfield | html %]" />
Comment 5 Owen Leonard 2021-02-16 13:33:58 UTC
Created attachment 116923 [details] [review]
Bug 27703: Make ID of category select field unique

Duplicate element IDs on the authorized values page are invalid and
cause a problem with the JavaScript intended to submit the form when the
category select field changes.

This patch changes the ID of the label and the field and makes the
corresponding change to the JavaScript.

To test, apply the patch and go to Administration -> Authorized values.

 - Click an authorized value category to view its contents.
 - Using mouse or keyboard, make a selection from the "Show category"
   dropdown menu.
 - The form should submit automatically and direct you to the
   corresponding category.
 - Validate the HTML of the page and confirm that there are no errors.
Comment 6 Owen Leonard 2021-02-16 13:45:34 UTC
Created attachment 116924 [details] [review]
Bug 27703: Make ID of category select field unique

Duplicate element IDs on the authorized values page are invalid and
cause a problem with the JavaScript intended to submit the form when the
category select field changes.

This patch changes the ID of the label and the field and makes the
corresponding change to the JavaScript.

To test, apply the patch and go to Administration -> Authorized values.

 - Click an authorized value category to view its contents.
 - Using mouse or keyboard, make a selection from the "Show category"
   dropdown menu.
 - The form should submit automatically and direct you to the
   corresponding category.
 - Validate the HTML of the page and confirm that there are no errors.
Comment 7 David Nind 2021-02-24 02:32:01 UTC
Created attachment 117231 [details] [review]
Bug 27703: Make ID of category select field unique

Duplicate element IDs on the authorized values page are invalid and
cause a problem with the JavaScript intended to submit the form when the
category select field changes.

This patch changes the ID of the label and the field and makes the
corresponding change to the JavaScript.

To test, apply the patch and go to Administration -> Authorized values.

 - Click an authorized value category to view its contents.
 - Using mouse or keyboard, make a selection from the "Show category"
   dropdown menu.
 - The form should submit automatically and direct you to the
   corresponding category.
 - Validate the HTML of the page and confirm that there are no errors.

Signed-off-by: David Nind <david@davidnind.com>
Comment 8 David Nind 2021-02-24 02:40:18 UTC
Now works as expected when trying to change the category from the dropdown list.

Not exactly sure how you want the HTML validated. I used Firefox Developer tools, and the HTML Validator - 30 warnings, along the lines of "Warning: trimming empty <i>", "Warning: trimming empty <b>", "Warning: trimming empty <span>", and "Warning: '<' + '/' + letter not allowed here". The WAVE accessibility checker toolbar shows different errors and warnings.
Comment 9 Martin Renvoize (ashimema) 2021-03-03 10:35:17 UTC
Created attachment 117560 [details] [review]
Bug 27703: Make ID of category select field unique

Duplicate element IDs on the authorized values page are invalid and
cause a problem with the JavaScript intended to submit the form when the
category select field changes.

This patch changes the ID of the label and the field and makes the
corresponding change to the JavaScript.

To test, apply the patch and go to Administration -> Authorized values.

 - Click an authorized value category to view its contents.
 - Using mouse or keyboard, make a selection from the "Show category"
   dropdown menu.
 - The form should submit automatically and direct you to the
   corresponding category.
 - Validate the HTML of the page and confirm that there are no errors.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 10 Martin Renvoize (ashimema) 2021-03-03 10:36:18 UTC
Works as expected and passes QA scripts.

No duplicate ID errors during validation and other validation issues can be caught in new bugs.

Passing QA
Comment 11 Jonathan Druart 2021-03-03 10:59:37 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 12 Fridolin Somers 2021-03-04 12:22:15 UTC
Pushed to 20.11.x for 20.11.04
Comment 13 Andrew Fuerste-Henry 2021-03-14 19:09:39 UTC
Pushed to 20.05.x for 20.05.10
Comment 14 Victor Grousset/tuxayo 2021-03-23 06:23:08 UTC
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.