Bug 41638

Summary: Patron record field labels lack distinct id in HTML
Product: Koha Reporter: Andrew Fuerste-Henry <andrew>
Component: TemplatesAssignee: Lisette Scheer <lisette>
Status: Needs Signoff --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: lisette
Version: Main   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: String patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This enhancement adds ids to all the labels on memberentry.pl with the convention of <label for="surname" id="surname_label"> for easier jquery selection.
Version(s) released in:
Circulation function:
Attachments: Bug 41638: Add IDs to labels on patron edit

Description Andrew Fuerste-Henry 2026-01-15 16:04:08 UTC
Libraries commonly use jQuery to reword the labels on various fields in the patron record (like changing "Surname" to "Last name"). Those field labels lack distinct IDs, which makes targeting them with jQuery more complicated and fragile:

  $('.label:contains("Surname")').text('Last name:');
  $('label[for="surname"]').text("Last name:");

If that label had an ID like "#surname_label" it would simplify things.
Comment 1 Lisette Scheer 2026-01-15 17:09:19 UTC
Created attachment 191519 [details] [review]
Bug 41638: Add IDs to labels on patron edit

When targeting with jquery and css, labels on the patron edit screen can be fragile and complicated.
This patch adds ids to all the labels that follow the following convention:

<label for="surname" class="required" id="surname_label">

Each id is the "for" with _label appended.

To Test:
1. Before applying the patch, go to add a new patron
2. Right click on the page and use the browser inspector/inspect element.
3. Observe there are no ids for the field labels.
4. Apply patch
5. Reload the page
6. Observe there are now ids for the fields.
7. Go through all the fields and confirm there is an id and that they follow the convention above.
8. Change mandatory fields and confirm the labels are still correct.
9. Edit an existing patron and confirm the ids are still present.
10. Sign off!