How to show DynamicFields hidden when we choose the queue

Moderator: crythias

Post Reply
tallesleonardo
Znuny newbie
Posts: 24
Joined: 23 May 2013, 03:25
Znuny Version: versao 6.0.19
Company: Hepta
Location: Brasília, BRAZIL

How to show DynamicFields hidden when we choose the queue

Post by tallesleonardo »

Hi Crythias,
Sorry for the last post on the solved topic. I am a beginner in OTRS and here.
This code is not doing what is supposed to do. I was trying to show 3 DynamicFields when I choose the queue. This is my code:

Code: Select all

<script type="text/javascript">//<![CDATA[
		
		Core.Agent.TicketAction.Init();
		function nonetext() {
			document.compose.Subject.value = "";
			document.compose.RichText.value = "";
			document.getElementById('DynamicField_TicketFreeText2').style.display = 'none';
			document.getElementById('LabelDynamicField_TicketFreeText2').style.display = 'none';
			document.getElementById('DynamicField_TicketFreeText7').style.display = 'none';
			document.getElementById('LabelDynamicField_TicketFreeText7').style.display = 'none';
			document.getElementById('DynamicField_TicketFreeText8').style.display = 'none';
			document.getElementById('LabelDynamicField_TicketFreeText8').style.display = 'none';
			
	}
		
		$('#Dest').bind('change', function (Event) {
        Core.AJAX.FormUpdate($('#NewPhoneTicket'), 'AJAXUpdate', 'Dest', ['TypeID', 'PriorityID', 'ServiceID', 'SLAID',$Data{"DynamicFieldNamesStrg"}]);
				
	var queue = $('#Dest').val();
	//window.alert(queue);
	if ( queue == "3\|\|CIA"){ 

	window.alert("A fila é:    "+ queue);
	  document.getElementById('DynamicField_TicketFreeText2').style.display = 'block';
	  document.getElementById('LabelDynamicField_TicketFreeText2').style.display = 'block';
	  document.getElementById('LabelDynamicField_TicketFreeText2').className = 'Mandatory';
		document.getElementById('DynamicField_TicketFreeText2').className = 'TicketFreeText  Validate_RequiredDropdown ServerError';
	  document.getElementById('DynamicField_TicketFreeText7').style.display = 'block';
      document.getElementById('LabelDynamicField_TicketFreeText7').style.display = 'block';
	  document.getElementById('LabelDynamicField_TicketFreeText7').className = 'Mandatory';
		document.getElementById('DynamicField_TicketFreeText7').className = 'TicketFreeText  Validate_RequiredDropdown ServerError';
	  document.getElementById('DynamicField_TicketFreeText8').style.display = 'block';
      document.getElementById('LabelDynamicField_TicketFreeText8').style.display = 'block';
	  document.getElementById('LabelDynamicField_TicketFreeText8').className = 'Mandatory';
		document.getElementById('DynamicField_TicketFreeText8').className = 'TicketFreeText  Validate_RequiredDropdown ServerError';
	  }
  
	});
//]]></script>
I dont know if I had to put the name of this Dynamic Field like this "DynamicField_TicketFreeText7" or "DynamicField_senha1", the same thing to Label
Thank you in advance.
Talles Leonardo
OTRS 6.0.19 on Linux with MySQL database
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: How to show DynamicFields hidden when we choose the queu

Post by crythias »

The fields will be named what you named them.
Please indicate your OTRS version. Note that your code is different from what's been presented.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
tallesleonardo
Znuny newbie
Posts: 24
Joined: 23 May 2013, 03:25
Znuny Version: versao 6.0.19
Company: Hepta
Location: Brasília, BRAZIL

Re: How to show DynamicFields hidden when we choose the queu

Post by tallesleonardo »

crythias wrote:The fields will be named what you named them.
Please indicate your OTRS version. Note that your code is different from what's been presented.
Version 3.1.6
Talles Leonardo
OTRS 6.0.19 on Linux with MySQL database
crythias
Moderator
Posts: 10169
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: How to show DynamicFields hidden when we choose the queu

Post by crythias »

tallesleonardo wrote:Version 3.1.6
Did you upgrade from 3.0?
tallesleonardo wrote:This code is not doing what is supposed to do. I was trying to show 3 DynamicFields when I choose the queue.
what are the DynamicField's names as you've configured them?
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
tallesleonardo
Znuny newbie
Posts: 24
Joined: 23 May 2013, 03:25
Znuny Version: versao 6.0.19
Company: Hepta
Location: Brasília, BRAZIL

Re: How to show DynamicFields hidden when we choose the queu

Post by tallesleonardo »

crythias wrote:
tallesleonardo wrote:Version 3.1.6
Did you upgrade from 3.0?
tallesleonardo wrote:This code is not doing what is supposed to do. I was trying to show 3 DynamicFields when I choose the queue.
what are the DynamicField's names as you've configured them?
I didnt make upgrade, but I am using the theme of my company.

The names of the Dynamic Fields are: senha1, senha2 and senha3.
I made this code with no knowledge, I am doing this only based on topic "How To show freetext for specific Queues for Customers ". This explains my questions and my code. Then I apologize again for my knowledge about the topic.
Talles Leonardo
OTRS 6.0.19 on Linux with MySQL database
tallesleonardo
Znuny newbie
Posts: 24
Joined: 23 May 2013, 03:25
Znuny Version: versao 6.0.19
Company: Hepta
Location: Brasília, BRAZIL

Re: How to show DynamicFields hidden when we choose the queu

Post by tallesleonardo »

Hi Crythias,
I solved the problem. Thanks for your help.

Code: Select all

<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
		Core.Agent.TicketAction.Init();
		function nonetext() {
			document.compose.Subject.value = "";
			document.compose.RichText.value = $('#Dest').val();
			document.getElementById('DynamicField_senha1').style.display = 'none';
			document.getElementById('LabelDynamicField_senha1').style.display = 'none';
			document.getElementById('DynamicField_senha2').style.display = 'none';
			document.getElementById('LabelDynamicField_senha2').style.display = 'none';
			document.getElementById('DynamicField_senha3').style.display = 'none';
			document.getElementById('LabelDynamicField_senha3').style.display = 'none';
			}
			nonetext();
			
		function showfileds(){
			document.compose.Subject.value = "";
			document.compose.RichText.value = $('#Dest').val();
			document.getElementById('DynamicField_senha1').style.display = 'block';
			document.getElementById('LabelDynamicField_senha1').style.display = 'block';
			document.getElementById('DynamicField_senha2').style.display = 'block';
			document.getElementById('LabelDynamicField_senha2').style.display = 'block';
			document.getElementById('DynamicField_senha3').style.display = 'block';
			document.getElementById('LabelDynamicField_senha3').style.display = 'block';
			}
		$('#Dest').bind('change', function (Event) {
        Core.AJAX.FormUpdate($('#NewPhoneTicket'), 'AJAXUpdate', 'Dest', ['TypeID', 'NewUserID', 'NewResponsibleID', 'NextStateID', 'PriorityID', 'ServiceID', 'SLAID', 'SignKeyID', 'CryptKeyID', $Data{"DynamicFieldNamesStrg"}, 'To', 'Cc', 'Bcc']);
			
			if (($('#Dest').val()) == "3\|\|CIA"){
			showfileds();
			} else if (($('#Dest').val())!= "3\|\|CIA"){
			nonetext();
			}
		});
		
//]]></script>
<!--dtl:js_on_document_complete-->
Talles Leonardo
OTRS 6.0.19 on Linux with MySQL database
Post Reply