show/hide dynamic fields on phone ticket

Kent Kollasch <[email protected]>
Newsgroups gmane.comp.otrs.user
Message-ID <[email protected]>
Hi,

I'm trying to show/hide dynamic fields on new phone ticket based on 
ticket type.

I'm having mixed results, only the first dynamic field shows up, the 
rest stay hidden.  I've add the following to 
Custom/Kernel/Output/HTML/Templates/Standard/AgentTicketPhone.tt.

[% RenderBlockStart("TicketType") %]
                     <label class="Mandatory" for="TypeID"><span 
class="Marker">*</span> [% Translate("Type") | html %]:</label>
                     <div class="Field">
                         [% Data.TypeStrg %]
                         <div id="TypeIDError" 
class="TooltipErrorMessage"><p>[% Translate("This field is required.") | 
html %]</p></div>
                         <div id="TypeIDServerError" 
class="TooltipErrorMessage"><p>[% Translate("This field is required.") | 
html %]</p></div>

[% WRAPPER JSOnDocumentComplete %]
<script type="text/javascript">//<![CDATA[
     $('#TypeID').bind('change', function (Event) {
         Core.AJAX.FormUpdate($('#NewPhoneTicket'), 'AJAXUpdate', 
'TypeID', ['Dest', 'NewUserID', 'NewResponsibleID', 'NextStateID', 
'PriorityID', 'ServiceID', 'SLAID', 'SignKeyID', 'CryptKeyID', 'To', 
'Cc', 'Bcc', 'StandardTemplateID' [% Data.DynamicFieldNamesStrg %]]);

### shows dynamic fields based on ticket type ###
        switch ($('#TypeID').val() ) {
              case "4":
                  document.getElementById('id name').style.display = 
'block';
              break;

         default:
                   document.getElementById('id name').style.display = 
'none';
        }

     });
//]]></script>
[% END %]


[% RenderBlockStart("DynamicField") %]
                         <div id="id name" style="display:none;" 
class="Row Row_DynamicField_[% Data.Name | html %]" 
className="TicketFreeText Validate_Required ServerError" >
                             [% Data.Label %]<div class="Field">[% 
Data.Field %]</div>
                             <div class="Clear"></div>
                         </div>
[% RenderBlockEnd("DynamicField") %]

Thanks,
Kent

-- 
Kent C. Kollasch<mailto:[email protected]>
Director of Information Technology
Art's-Way Manufacturing Co., Inc.
Phone: (712) 864-0025
Fax: (712) 864-3154

This message may contain information that is confidential and subject to privilege.
If you are not the intended recipient and have received this e-mail in error, please
disregard and do not open attachments, if any. Please note that the view or opinions
presented in this e-mail are solely those of the author.

---------------------------------------------------------------------
OTRS mailing list: otrs - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/otrs
To unsubscribe: http://lists.otrs.org/mailman/listinfo/otrs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.