crythias wrote:
Because the whole page refreshes. You'll need to test for current Dest value and switch against it at the bottom of the page.
... Ok, following your hints I have come to this code:
"inside" the CustomerTicketMessage.dtl
Code: Select all
<script type="text/javascript">//<![CDATA[
function nonetext() {
document.compose.Subject.value = "";
CKEDITOR.instances.RichText.setData( '' );
document.getElementById('DynamicField_TicketFreeText1').style.display = 'none';
document.getElementById('LabelDynamicField_TicketFreeText1').style.display = 'none';
}
$('#Dest').bind('change', function (Event) {
Core.AJAX.FormUpdate($('#NewCustomerTicket'), 'AJAXUpdate', 'Dest', ['TypeID', 'PriorityID', 'ServiceID', 'SLAID', $Data{"DynamicFieldNamesStrg"}]);
switch ($('#Dest').val() ) {
case "10\|\|Queue_A": // need to slash escape the pipes
nonetext();
document.getElementById('DynamicField_TicketFreeText1').style.display = 'block';
document.getElementById('LabelDynamicField_TicketFreeText1').style.display = 'block';
document.getElementById('LabelDynamicField_TicketFreeText1').className = 'Mandatory';
document.getElementById('DynamicField_TicketFreeText1').className = 'TicketFreeText Validate_RequiredDropdown ServerError';
break;
default:
nonetext();
} // End switch
});
//]]></script>
And at the end...
Code: Select all
<script type="text/javascript">//<![CDATA[
Core.Customer.InitFocus();
switch ($('#Dest').val() ) {
case "10\|\|Queue_A": // need to slash escape the pipes
nonetext();
document.getElementById('DynamicField_TicketFreeText1').style.display = 'block';
document.getElementById('LabelDynamicField_TicketFreeText1').style.display = 'block';
document.getElementById('LabelDynamicField_TicketFreeText1').className = 'Mandatory';
document.getElementById('DynamicField_TicketFreeText1').className = 'TicketFreeText Validate_RequiredDropdown ServerError';
break;
default:
nonetext();
} // End switch
//]]></script>
Now, however, if the customer first select Queue_A and then he changes idea and select another Queue without having specified any value for 'DynamicField_TicketFreeText1' custom attribute, he will not be able to submit his ticket at all, because - unexpectedly to me - once .className = 'Mandatory' has been set, it cannot be "unset" anymore
On the other hand, if the customer first select Queue_A and then he changes idea and select another Queue, this time having selected a value for if the customer first select Queue_A and then he changes idea and select another Queue, that value will remain set also for the ticket created in the other queue: in other words once the customer has gone through the selection of Queue_A and then he select another queue, it seems not possible to "unset" or set to a null value the 'DynamicField_TicketFreeText1' for all queues different than Queue_A.
I tryed to set something like:
Code: Select all
default:
nonetext();
document.compose.DynamicField_TicketFreeText1.value = "";
with no result.
OTRS 6.0.x on CentOS 7.x with MariaDB 10.2.x database connected to an Active Directory for Agents and Customers.
ITSM and FAQ modules installed.