最近の検索
最近の検索はありません

C A
参加日2024年3月14日
·
前回のアクティビティ2024年4月25日
フォロー中
0
フォロワー
0
合計アクティビティ
13
投票
1
受信登録
3
アクティビティの概要
バッジ
記事
投稿
コミュニティへのコメント
記事へのコメント
アクティビティの概要
さんの最近のアクティビティ C A
C Aさんがコメントを作成しました:
Noelle Cheng You can always use a second script to change the wording and remove it from the main script
// Function to replace text
function replaceText(element, oldText, newText) {
if (element.innerText) {
element.innerText = element.innerText.replace(oldText, newText);
} else if (element.textContent) {
element.textContent = element.textContent.replace(oldText, newText);
}
}
コメントを表示 · 投稿日時:2024年4月25日 · C A
0
フォロワー
0
投票
0
コメント
C Aさんがコメントを作成しました:
Noelle Cheng, I copy pasted the code from my instance. You would just need to make sure that you swap out the IDs.
In the bit where you check for a certain drop down value var formDropdownClass =
I have multiple drop down options added, as I needed to have attachments mandatory for multiple forms.
// Can't submit supply variance or damage ticket without attachment
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 are observed:
// clear or select Attachment checkbox according to attachments
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_30367309244953';
var attachmentCheckboxId = '#' + attachmentCheckboxField;
var attachmentErrorNotification = 'Attachments cannot be blank';
var formDropdownClass = '.request_custom_fields_19908729240857, .request_custom_fields_30367309244953';
var formObserveMutationOptions = { childList: true, subtree: true };
// Clear or select checkbox according to attachments:
// Set Attachment checkbox if at least one attachment is uploaded, otherwise clear it
function setFormAttachmentCheckbox() {
if ($('#request-attachments-pool .upload-item').length >= 1) {
selectCheckbox(attachmentCheckboxId);
} else {
clearCheckbox(attachmentCheckboxId);
}
}
// Select checkbox
function selectCheckbox(eltselector) {
$(eltselector).prop('checked', true);
}
// Clear checkbox
function clearCheckbox(eltselector) {
$(eltselector).prop('checked', false);
}
// If attachment checkbox field exists:
// Watch for changes to attachments
if ($(attachmentCheckboxId).length) {
startObserveMutations('#request-attachments-pool', formObserveMutationOptions, mutationObservedForm);
}
// Adjust attachment error notification
var attachmentErrorElt = $(attachmentCheckboxId + ' .notification-error');
if (attachmentErrorElt.length) {
attachmentErrorElt.text(attachmentErrorNotification);
}
// Initial checkbox setting
setFormAttachmentCheckbox();
That's how it looks like if no attachment is added
コメントを表示 · 投稿日時:2024年4月24日 · C A
0
フォロワー
0
投票
0
コメント
C Aさんがコメントを作成しました:
Noelle Cheng Did you swap out the XXXXX for your field ID?
e.g.:
var attachmentCheckboxField = 'request_custom_fields_XXXXXX';
var attachmentCheckboxId = '#' + attachmentCheckboxField;
var attachmentErrorNotification = 'User request template must be attached';
var formDropdownClass = '.request_custom_fields_XXXXXX';
#request_custom_fields_XXXXXX_label,
#request_custom_fields_XXXXXX {
コメントを表示 · 投稿日時:2024年4月23日 · C A
0
フォロワー
0
投票
0
コメント
C Aさんがコメントを作成しました:
I got this code working for my instance (Copenhagen theme). Added to script.js.
You need to create a check box (call it whatever you want. I called mine Attachments) and make it mandatory to submit a ticket.
Add the Checkbox to the form you want to use at the very bottom. Copy the ID for both the drop down menu where you need attachments and check box and remove the X's with the corresponding IDs.
// Can't submit damage ticket without attachment
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 are observed:
// clear or select Attachment checkbox according to attachments
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_XXXXXX';
var attachmentCheckboxId = '#' + attachmentCheckboxField;
var attachmentErrorNotification = 'Attachments cannot be blank';
var formDropdownClass = '.request_custom_fields_XXXXXX';
var formObserveMutationOptions = { childList: true, subtree: true };
// Clear or select checkbox according to attachments:
// Set Attachment checkbox if at least one attachment is uploaded, otherwise clear it
function setFormAttachmentCheckbox() {
if ($('#request-attachments-pool .upload-item').length >= 1) {
selectCheckbox(attachmentCheckboxId);
} else {
clearCheckbox(attachmentCheckboxId);
}
}
// Select checkbox
function selectCheckbox(eltselector) {
$(eltselector).prop('checked', true);
}
// Clear checkbox
function clearCheckbox(eltselector) {
$(eltselector).prop('checked', false);
}
// If attachment checkbox field exists:
// Watch for changes to attachments
if ($(attachmentCheckboxId).length) {
startObserveMutations('#request-attachments-pool', formObserveMutationOptions, mutationObservedForm);
}
// Adjust attachment error notification
var attachmentErrorElt = $(attachmentCheckboxId + ' .notification-error');
if (attachmentErrorElt.length) {
attachmentErrorElt.text(attachmentErrorNotification);
}
// Initial checkbox setting
setFormAttachmentCheckbox();
Lastly, add this to style.css hide the check box field in the form. Replacing the X's with the checkbox ID
#request_custom_fields_XXXXXX_label,
#request_custom_fields_XXXXXX {
display: none;
}
コメントを表示 · 投稿日時:2024年4月01日 · C A
0
フォロワー
0
投票
0
コメント
C Aさんがコメントを作成しました:
Update:
I got this code working for my instance (Copenhagen theme). Added to script.js.
You need to create a check box (call it whatever you want. I called mine Attachments) and make it mandatory to submit a ticket.
Add the Checkbox to the form you want to use at the very bottom. Copy the ID for both the drop down menu where you need attachments and check box and remove the X's with the corresponding IDs.
// Can't submit damage ticket without attachment
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 are observed:
// clear or select Attachment checkbox according to attachments
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_XXXXXX';
var attachmentCheckboxId = '#' + attachmentCheckboxField;
var attachmentErrorNotification = 'Attachments cannot be blank';
var formDropdownClass = '.request_custom_fields_XXXXXX';
var formObserveMutationOptions = { childList: true, subtree: true };
// Clear or select checkbox according to attachments:
// Set Attachment checkbox if at least one attachment is uploaded, otherwise clear it
function setFormAttachmentCheckbox() {
if ($('#request-attachments-pool .upload-item').length >= 1) {
selectCheckbox(attachmentCheckboxId);
} else {
clearCheckbox(attachmentCheckboxId);
}
}
// Select checkbox
function selectCheckbox(eltselector) {
$(eltselector).prop('checked', true);
}
// Clear checkbox
function clearCheckbox(eltselector) {
$(eltselector).prop('checked', false);
}
// If attachment checkbox field exists:
// Watch for changes to attachments
if ($(attachmentCheckboxId).length) {
startObserveMutations('#request-attachments-pool', formObserveMutationOptions, mutationObservedForm);
}
// Adjust attachment error notification
var attachmentErrorElt = $(attachmentCheckboxId + ' .notification-error');
if (attachmentErrorElt.length) {
attachmentErrorElt.text(attachmentErrorNotification);
}
// Initial checkbox setting
setFormAttachmentCheckbox();
Lastly, add this to style.css hide the check box field in the form. Replacing the X's with the checkbox ID
#request_custom_fields_XXXXXX_label,
#request_custom_fields_XXXXXX {
display: none;
}
コメントを表示 · 投稿日時:2024年4月01日 · C A
0
フォロワー
0
投票
0
コメント
C Aさんがコメントを作成しました:
After testing, I found out that the issue was the mandatory checkbox. Removed said box and the errors show up again.
I would still need to have attachments mandatory.
I've modified the script in the post above and enabled the attachment field when the drop down option is selected. So that works. Even if an attachment is uploaded, it ticks the box. But if end users click on submit without filling in mandatory fields. No error shows up and they are getting redirected. Do mandatory checkboxes not work?
// Can't submit damage ticket without attachment
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 are observed:
// clear or select Attachment checkbox according to attachments
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_30367309244953';
var attachmentCheckboxId = '#' + attachmentCheckboxField;
var attachmentErrorNotification = 'Attachments cannot be blank';
var formDropdownClass = '.request_custom_fields_19906073817113';
var formObserveMutationOptions = { childList: true, subtree: true };
// Clear or select checkbox according to attachments:
// Set Attachment checkbox if at least one attachment is uploaded, otherwise clear it
function setFormAttachmentCheckbox() {
if ($('#request-attachments-pool .upload-item').length >= 1) {
selectCheckbox(attachmentCheckboxId);
} else {
clearCheckbox(attachmentCheckboxId);
}
}
// Select checkbox
function selectCheckbox(eltselector) {
$(eltselector).prop('checked', true);
}
// Clear checkbox
function clearCheckbox(eltselector) {
$(eltselector).prop('checked', false);
}
// If attachment checkbox field exists:
// Watch for changes to attachments
if ($(attachmentCheckboxId).length) {
startObserveMutations('#request-attachments-pool', formObserveMutationOptions, mutationObservedForm);
}
// Adjust attachment error notification
var attachmentErrorElt = $(attachmentCheckboxId + ' .notification-error');
if (attachmentErrorElt.length) {
attachmentErrorElt.text(attachmentErrorNotification);
}
// Initial checkbox setting
setFormAttachmentCheckbox();
コメントを表示 · 投稿日時:2024年4月01日 · C A
0
フォロワー
0
投票
0
コメント
C Aさんが投稿を作成しました:
I'm currently experiencing the issue that Zendesk is redirected end users to the My Activities page even if the required fields are left blank.
I was checking the backend and could see that no tickets were created. But no error message appeared that required fields are empty and redirected users to the My Activities page.
Previously, I was trying to implement said code from article https://support.zendesk.com/hc/fr/community/posts/4409515169946-Requiring-a-ticket-attachment-if-a-particular-dropdown-option-is-selected
I suspected that this was the issue, so I've removed the code again. But I'm still getting the same issue.
I am trying to force end users to provide attachments if they choose a specific value in a drop down field.
投稿日時:2024年4月01日 · C A
0
フォロワー
1
投票
2
コメント
C Aさんがコメントを作成しました:
Hi Jakub
I've managed to by adding this at the end of the script.js
document.addEventListener('DOMContentLoaded', function() {
// Function to replace text
function replaceText(element, oldText, newText) {
if (element.innerText) {
element.innerText = element.innerText.replace(oldText, newText);
} else if (element.textContent) {
element.textContent = element.textContent.replace(oldText, newText);
}
}// Replace text for the specific anchor with href="/hc/en-nz/requests"
var linkElement = document.querySelector('a[href="/hc/en-nz/requests"]');
if (linkElement) {
replaceText(linkElement, 'My activities', 'My requests');
}
});
コメントを表示 · 投稿日時:2024年3月15日 · C A
0
フォロワー
0
投票
0
コメント
C Aさんが投稿を作成しました:
Is it still possible to adjust the text that is on the drop down menu and change the text from My Activities to My Requests
Tried both and added them to script.js but no luck so far
//Change string for My Activities
$('.user-nav .my-activities').html(' See my requests');
$('.sub-nav').find('li').filter(":last");
and
//Change string for My Activities
$('.nav-wrapper .dropdown-menu .my-activities').html('My Requests');
$('.sub-nav').find('li').filter(":last");
投稿日時:2024年3月14日 · C A
0
フォロワー
2
投票
2
コメント