[Rt-commit] rt 01/01: Ensure unique ID values for external custom field values inputs

craig kaiser craig at bestpractical.com
Mon Jul 26 18:46:20 UTC 2021


This is an automated email from the git hooks/post-receive script.

craig pushed a commit to branch 5.0/unique-id-external-values
in repository rt.

commit 8735c210a051a370a6728850ad50204953c6cb01
Author: craig kaiser <craig at bestpractical.com>
AuthorDate: Mon Jul 26 14:44:17 2021 -0400

    Ensure unique ID values for external custom field values inputs
    
    RT::CustomFieldValue objects generated from external values all have an
    ID value of 1. Bootstrap requires checkboxes and radio inputs to have
    unique "id" attributes in order to work.
---
 share/html/Elements/EditCustomFieldSelect | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/share/html/Elements/EditCustomFieldSelect b/share/html/Elements/EditCustomFieldSelect
index 7539711a25..39c0302681 100644
--- a/share/html/Elements/EditCustomFieldSelect
+++ b/share/html/Elements/EditCustomFieldSelect
@@ -68,9 +68,16 @@
 % }
 %   }
 %   my $CFVs = CachedCustomFieldValues($CustomField);
+%#  Since exteneral custom field values all have the same ID (1) we need to increment a
+%#  variable for unique input ID values.
+%   my $i = 0;
 %   while ( my $value = $CFVs->Next ) {
 %     my $content = $value->Name;
 %     my $labelid = "$name-". $value->id;
+%     if ( $CustomField->IsExternalValues ) {
+%         $labelid = "$name-$i";
+%         $i++;
+%     }
 <div data-name="<% $value->Category || '' %>" class="custom-control custom-<% $checktype %>">
   <input class="custom-control-input"  type="<% $checktype %>" name="<% $name %>" id="<% $labelid %>" value="<% $content %>" <% $default{ lc $content }? ' checked="checked"' : '' |n%> />
   <label class="custom-control-label" for="<% $labelid %>"><% $content %></label><br />

-- 
To stop receiving notification emails like this one, please contact
sysadmin at bestpractical.com.


More information about the rt-commit mailing list