[rt-users] Howto: Pseudo read-only custom fields

Jeff Blaine jblaine at kickflop.net
Mon Mar 29 18:50:27 EDT 2010


Just sharing.  This is how I disabled editing of certain custom
fields via the web UI.

Part 1: Make the word READONLY appear in your custom field's
         description.

Part 2: Edit share/html/Tickets/Elements/EditCustomFields
         (or whatever proper 'local' file :)) to look like this
         for the "table row" block.


...stuff here...
<tr>
% }
     <td class="cflabel">
       <b><% loc($CustomField->Name) %></b><br />
       <i>Type: <% $CustomField->FriendlyType %></i>
     </td>
% if ($CustomField->Description =~ /READONLY/) {
     <td class="entry"><b>READ-ONLY FIELD</b></td>
% } else {
     <td class="entry">
%   my $default = $m->notes('Field-' . $CustomField->Id);
%   $default ||= $ARGS{"CustomField-". $CustomField->Id };
         <& /Elements/EditCustomField,
             %ARGS,
             Object => $TicketObj,
             CustomField => $CustomField,
             NamePrefix => $NamePrefix,
             Default => $default,
         &>
%   if (my $msg = $m->notes('InvalidField-' . $CustomField->Id)) {
           <br />
           <span class="cfinvalidfield"><% $msg %></span>
%   }
     </td>
% }

% unless ( $i % 2 ) {
</tr>
...stuff here...




More information about the rt-users mailing list