Recent searches


No recent searches

Hiding a ticket form on the 'submit a request' page

Answered


Posted Aug 12, 2021

Hi!

I need to know how to hide a form from the 'submit a request' page drop down option, we don't want customers able to select it from the list (we are currently doing a trial by sending them a hyperlink to it through email contact). Customers are not required to sign in to submit a form so we can't use the option of hiding dependant on organisation (saw an article recommending this).

Does anyone know how I can do this please? Newbie coder here so not sure how to go around doing this!


2

99

99 comments

image avatar

Eric Norris

Zendesk Luminary

We got an updated script that seems to work. Not sure how, and there might be a more elegant way of writing it, but it seems to work. Hope this helps:

  var tagsToRemove = ['thing_1','thing_2','thing_3'];
 removeTagsWeDontWant();
 
 function removeTagsWeDontWant()
 {
   const removeNodes = (node) => {
     for (let i = 0; i < node.childNodes.length; i++) {
       const wasRemoved = removeNodes(node.childNodes[i]);
       if (wasRemoved) {
         i--;
       }
     }

     if (node.nodeType === 1 && tagsToRemove.includes(node.getAttribute("id"))) {
       node.parentNode.removeChild(node);
       return true;
     }
     return false;
   };

   const observer = new MutationObserver(mutationList =>
     mutationList.filter(m => m.type === 'childList').forEach(m => {
       m.addedNodes.forEach(removeNodes); 
     }));  
   document.querySelectorAll('.nesty-panel').forEach(panel => observer.observe(panel,{childList: true, subtree: true}));
 }

1


So once we hide the other forms and then what if we want to access the hide form for our internal access on admin side then how can we access them. 

0


Eric, you're the man! Thank you, it works for me too 😊

(It just lacks the last } , it's just a copy-paste issue I believe! For the others that might be impacted)

0


Hello,

 

Does anyone know the code from removing one of the forms from the front page instead pleaase? We still need to rest to show.  It's just that we are giving a direct link to one of the forms and don't want others using it.

0


Katrina CAIN  - you can use this code. Replace 12345 with your form id that you want to hide. This will go at the bottom of the Style.css:

.id-12345 { 
 display:none
}

0


image avatar

Jahn

Zendesk LuminaryCommunity Moderator

Thank you Eric Norris  - works for me as well and I didn't know about the chrome update hence some fields are reflecting to the end users. 

Thanks a lot for this! 

0


image avatar

이지훈(maclaude)

Zendesk Luminary

To. Eric Norris

 

The code you wrote seems to be a solution for "Hide Specific Dropdown Values".

https://support.zendesk.com/hc/en-us/community/posts/6101512122650-Hide-Specific-Dropdown-Values

 

Your code works really beautifully for the above issue. However, when I use :: in the options field of the ticket to give it a hierarchy, the hidden options don't hide the first level.

Do you know anything about this issue?

 

 

 

 

 

0


image avatar

이지훈(maclaude)

Zendesk Luminary

to. Eric Norris

I found a way, even though I'm clumsy.
I changed the IF statement in your code like below. Then I was able to remove the ticket field name .

Thank you~!

if (node.nodeType === 1 && tagsToRemove.includes(node.getAttribute("id")) || node.innerHTML === "option value") {

0


Hannah Lucid Thanks Hannah I did try this and unfortunately it's still showing on the front page.

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post