최근 검색


최근 검색 없음

Ben Weaving's Avatar

Ben Weaving

가입한 날짜: 2021년 4월 15일

·

마지막 활동: 2021년 10월 29일

팔로잉

0

팔로워

0

총 활동 수

8

투표 수

2

플랜 수

4

활동 개요

님의 최근 활동 Ben Weaving

Ben Weaving님이 에 댓글을 입력함

커뮤니티 댓글 Feedback - Ticketing system (Support)

We need this for large corporate customers and it's rather bemusing this actually isn't possible on such a fantastic product. Zendesk please look into this as a serious change request.

 

Increments of 5 mins would be ideal!

 

 

Thankyou

댓글 보기 · 2021년 1월 26일에 게시됨 · Ben Weaving

0

팔로워

0

투표 수

0

댓글


Ben Weaving님이 에 댓글을 입력함

커뮤니티 댓글 Discussion - Tips and best practices from the community

I am also struggling to get this functioning.

Code as below

Console log output

Code implemented, changing only the elements you mentioned.

 

 

$(document).ready(function() {
// Function to start observing node for mutations
var startObserveMutations = function (nodeSelector, options, callbackFunction) {
var node = document.querySelector(nodeSelector);
if (node) {
var observer = new MutationObserver(callbackFunction);
observer.observe(node, options);
return observer;
}
};

// Callback function to execute when mutations in form attachments or dropdown are observed:
// clear or select Attachment checkbox according to dropdown
var mutationObservedForm = function (mutationsList) {
mutationsList.forEach(function (mutation) {
if (mutation.type == 'childList') {
setFormAttachmentCheckbox();
}
});
};

// Define some variables for requiring form attachments
var attachmentCheckboxField = 'request_custom_fields_360012233180';
var attachmentCheckboxId = '#' + attachmentCheckboxField;
var attachmentErrorNotification = 'Attachments required before submitting';
var formDropdownClass = '.request_custom_fields_360012190719';
var formObserveMutationOptions = { childList: true, subtree: true };

// Clear or select checkbox according to dropdown and attachments:
// Set Attachment checkbox if no attachments required, or if attachments are required and at least one is uploaded, otherwise clear it
function setFormAttachmentCheckbox() {
if (isFormAttachmentRequired()) {
if ($('#request-attachments-pool .upload-item').length) {
selectCheckbox(attachmentCheckboxId);
}
else {
clearCheckbox(attachmentCheckboxId);
}
}
else {
selectCheckbox(attachmentCheckboxId);
}
}

// Return true if dropdown option 'ABCD' is selected
function isFormAttachmentRequired() {
return $(formDropdownClass + ' a.nesty-input').attr('aria-expanded') &&
$(formDropdownClass + ' a.nesty-input').text() === 'no';
}

// Select checkbox
function selectCheckbox(eltselector) {
$(eltselector).prop('checked', true);
}

// Clear checkbox
function clearCheckbox(eltselector) {
$(eltselector).prop('checked', false);
}

// If attachment checkbox field exists:
// Select the checkbox if attachment is not required
// Watch for changes to attachments and dropdown
if ($(attachmentCheckboxId).length) {
if (!isFormAttachmentRequired(formAttachmentDropdownClass)) {
selectCheckbox(attachmentCheckboxId);
}
startObserveMutations('#request-attachments-pool', formObserveMutationOptions, mutationObservedForm);
startObserveMutations(formDropdownClass, formObserveMutationOptions, mutationObservedForm);
}

// Adjust attachment error notification
var attachmentErrorElt = $('.' + attachmentCheckboxField + ' .notification-error');
if (attachmentErrorElt.length) {
attachmentErrorElt.text(attachmentErrorNotification);
}

댓글 보기 · 2020년 7월 14일에 게시됨 · Ben Weaving

0

팔로워

0

투표 수

0

댓글