Bug 29303 - Quick add form duplicates HTML ID's
Summary: Quick add form duplicates HTML ID's
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: master
Hardware: All All
: P5 - low minor (vote)
Assignee: Lucas Gass
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-21 20:03 UTC by Lucas Gass
Modified: 2022-06-16 19:17 UTC (History)
5 users (show)

See Also:
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 (2.75 KB, patch)
2021-10-21 20:18 UTC, Lucas Gass
Details | Diff | Splinter Review
Bug 29330: (QA follow-up) Use passed MIME type (1.11 KB, patch)
2021-11-08 11:12 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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.