From eed1403a732b4de6656f3f4caef2718ed2f9d0fe Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Thu, 21 Oct 2021 20:13:37 +0000 Subject: [PATCH] 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. --- .../prog/en/modules/members/memberentrygen.tt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index 204c59723e..1c15039ba1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -1806,10 +1806,18 @@ legend:hover { input_label='title'; } if( qaddfields.indexOf( input_label ) != -1 || $(this).attr('class') == 'required' ){ - $(this).parent().clone().appendTo("#quick_add_list"); - [% UNLESS mandatorypassword %] - if( input_label == 'password' ) $("#entryform label[for='password2']").parent().clone().appendTo("#quick_add_list"); - [% END %] + var this_id = $(this).siblings().attr('id'); + if ( this_id ) { + $(this).attr('for' , 'qa_' + this_id).parent().clone().appendTo("#quick_add_list").children().attr('id' , 'qa_' + this_id); + [% UNLESS mandatorypassword %] + if( input_label == 'password' ) $("#entryform label[for='password2']").parent().clone().appendTo("#quick_add_list").attr('id' , 'qa_' + this_id); + [% END %] + } else { + $(this).parent().clone().appendTo("#quick_add_list"); + [% UNLESS mandatorypassword %] + if( input_label == 'password' ) $("#entryform label[for='password2']").parent().clone().appendTo("quick_add_list"); + [% END %] + } } }); if ( $("#memberentry_guarantor").length ) { -- 2.20.1