Dear Community,
I'm currently working on configuring our script.js file. Many of our formulas do not require customers to input any messages in the description field, which is why I have currently hidden this part. However, as this field is mandatory, I'm currently inputting a constant string "Custom Field text."
I would like to replace this constant text with a variable that depends on the customer's input in a customField. The text in the customField and the description field should be identical.
Here is my current code, which I borrowed from the community moderator, @ifra
document.addEventListener("DOMContentLoaded", function () {
function checkTicketId(){
var descriptionWarpper = document.querySelector('.form-field.request_description');
var descriptionField = document.querySelector('#request_description');
var descriptionLabel = document.querySelector(".form-field.text.required.request_description > label");
var attachmentWarpper = document.querySelector('label[for="request-attachments"]');
var dropzoneWarpper = document.querySelector('#upload-dropzone');
descriptionWarpper.style.display= "block";
descriptionLabel.innerHTML = 'Beskrivelse';
if(window.location.href.indexOf('14154610162461' ) > 1) {
descriptionWarpper.style.display= "none";
descriptionField.innerHTML = "Custom Field text";
attachmentWarpper.style.display= "none";
dropzoneWarpper.style.display= "none";
} else if(window.location.href.indexOf('14154601112989') > 1) {
descriptionWarpper.style.display= "none";
descriptionField.innerHTML = 'Custom Field text';
attachmentWarpper.style.display= "none";
dropzoneWarpper.style.display= "none";
} else if(window.location.href.indexOf('14200136091677') > 1) {
descriptionWarpper.style.display= "none";
descriptionField.innerHTML = 'Custom Field text';
attachmentWarpper.style.display= "none";
dropzoneWarpper.style.display= "none";
}
}
checkTicketId();
});