Bug 29303

Summary: Quick add form duplicates HTML ID's
Product: Koha Reporter: Lucas Gass <lucas>
Component: PatronsAssignee: Lucas Gass <lucas>
Status: Failed QA --- QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: fridolin.somers, gmcharlt, kyle.m.hall, sally.healey, tomascohen
Version: master   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19249
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 29303: Give quick add form fields new ID and for attributes
Bug 29330: (QA follow-up) Use passed MIME type

Description Lucas Gass 2021-10-21 20:03:57 UTC
We noticed while trying to add some jQuery to the quick add from that there are duplicate id's on the page for each input. 

The jQuery on memberentrygen.tt checks to see what fields should be present on the quick_add_form and then uses jQuery clone() to add them to the quick_add_form.

The problem is this creates duplicate ID's which is invalid HTML. We should change those cloned ID's so they are not duplicates.
Comment 1 Lucas Gass 2021-10-21 20:18:05 UTC
Created attachment 126681 [details] [review]
Bug 29303: Give quick add form fields new ID and for attributes

To test:
1.Go to the quick add patron form
2. Use the browser dev tools to notice that there are duplicate ID's for every input on the qa form. One is showing and one is hidden.
3. These duplicate ID's won't show up in the page source because they are added with JS.
4. Apply patch
5. Try step 2 again, the quick add form fields should have an ID starting with 'qa_'. The labels 'for' attribute should aslo have this.
6. Make sure the patron quick add form still works.
7. Add several new fields to the patron qa form and make sure everything is right.
Comment 2 Owen Leonard 2021-10-29 11:36:48 UTC
It looks like this is adding a duplicate id to <label>s:

<label for="qa_surname" class="required" id="qa_surname">Surname: </label>
<input type="text" id="qa_surname" name="surname"...
Comment 3 Tomás Cohen Arazi 2021-11-08 11:12:53 UTC Comment hidden (obsolete)
Comment 4 Sally 2022-06-16 13:57:02 UTC
Hi Lucas, 

Is there any chance you could take another look at this?  

I'd love to be able to use jQuery on the quick add form and the duplicate ids are a real problem.